< Summary

Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 52
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
.ctor(...)100%6100%
get_Palette()100%1100%
get_Bytes()100%1100%

File(s)

https://raw.githubusercontent.com/JeremyAnsel/JeremyAnsel.ColorQuant/6d66b33d08452017f55aed57c4f1133aa87f71ea/JeremyAnsel.ColorQuant/JeremyAnsel.ColorQuant/ColorQuantizerResult.cs

#LineLine coverage
 1// <copyright file="ColorQuantizerResult.cs" company="Jérémy Ansel">
 2// Copyright (c) 2014-2019 Jérémy Ansel
 3// </copyright>
 4// <license>
 5// Licensed under the MIT license. See LICENSE.txt
 6// </license>
 7
 8namespace JeremyAnsel.ColorQuant
 9{
 10    using System;
 11    using System.Diagnostics.CodeAnalysis;
 12
 13    /// <summary>
 14    /// A result of color quantization.
 15    /// </summary>
 16    public sealed class ColorQuantizerResult
 17    {
 18        /// <summary>
 19        /// Initializes a new instance of the <see cref="ColorQuantizerResult"/> class.
 20        /// </summary>
 21        /// <param name="size">The size of the result.</param>
 22        /// <param name="colorCount">The color count.</param>
 3623        public ColorQuantizerResult(int size, int colorCount)
 24        {
 3625            if (size < 1)
 26            {
 227                throw new ArgumentOutOfRangeException(nameof(size));
 28            }
 29
 3430            if (colorCount < 1 || colorCount > 256)
 31            {
 432                throw new ArgumentOutOfRangeException(nameof(colorCount));
 33            }
 34
 3035            this.Palette = new byte[colorCount * 4];
 3036            this.Bytes = new byte[size];
 3037        }
 38
 39        /// <summary>
 40        /// Gets the palette (XRGB or ARGB).
 41        /// </summary>
 42        [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Reviewed")]
 3298643        public byte[] Palette { get; private set; }
 44
 45        /// <summary>
 46        /// Gets the bytes.
 47        /// </summary>
 48        [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Reviewed")]
 1133649        public byte[] Bytes { get; private set; }
 50    }
 51}
 52