Beispiel #1
0
        public void MustBeSizedAtLeast_Array_LengthIsLess_ThrowsException()
        {
            ArgumentException exception = Assert.Throws <ArgumentException>(
                () => DebugGuard.MustBeSizedAtLeast <int>(new int[] { 1, 2 }, 3, "myParamName"));

            Assert.Equal("myParamName", exception.ParamName);
            Assert.Contains($"The size must be at least 3.", exception.Message);
        }
        public void MustBeSizedAtLeast_Span_LengthIsLess_ThrowsException()
        {
            var exception = Assert.Throws <ArgumentException>(() =>
            {
                DebugGuard.MustBeSizedAtLeast(new Span <int>(new int[2]), new Span <int>(new int[3]), "myParamName");
            });

            Assert.Equal("myParamName", exception.ParamName);
            Assert.Contains($"Span-s must be at least of length 3.", exception.Message);
        }
Beispiel #3
0
 public void MustBeSizedAtLeast_Array_LengthIsGreaterOrEqual_ThrowsNoException(int[] value, int minLength)
 {
     DebugGuard.MustBeSizedAtLeast <int>(value, minLength, "myParamName");
 }
 public void MustBeSizedAtLeast_Span_LengthIsEqualOrGreater_DoesNotThowException(int leftSize, int rightSize)
 {
     DebugGuard.MustBeSizedAtLeast(new Span <int>(new int[leftSize]), new Span <int>(new int[rightSize]), "myParamName");
 }
Beispiel #5
0
        public static void EncodePaethFilter(ReadOnlySpan <byte> scanline, Span <byte> previousScanline, Span <byte> result, int bytesPerPixel, out int sum)
        {
            DebugGuard.MustBeSameSized <byte>(scanline, previousScanline, nameof(scanline));
            DebugGuard.MustBeSizedAtLeast(result, scanline, nameof(result));

            ref byte scanBaseRef   = ref MemoryMarshal.GetReference(scanline);