public void Constructor_NegativeGammaThrowsArgumentOutOfRangeException()
 {
     // Assert
     Assert.Throws <ArgumentOutOfRangeException>(() => {
         // Act
         var effect = new GammaEffect(-1d);
     });
 }
        public void Constructor_InitializesExpectedProperties()
        {
            // Act
            var effect = new GammaEffect(0.5d);

            // Assert
            Assert.Equal(0.5d, effect.Gamma);
        }
        public void ISerializable_DeserializeNegativeGammaThrowsException()
        {
            // Arrange
            var info = MockSerializationInfo <GammaEffect>();

            info.AddValue("Gamma", -1d);

            // Act
            Assert.Throws <ArgumentOutOfRangeException>(() => {
                var actual = new GammaEffect(info, new StreamingContext());
            });
        }
        public void ISerializable_SerializeAndDeserializeCorrectly()
        {
            // Arrange
            var expected = new GammaEffect(0.5d);
            var info     = MockSerializationInfo <GammaEffect>();

            // Act
            expected.GetObjectData(info, new StreamingContext());
            var actual = new GammaEffect(info, new StreamingContext());

            // Assert
            Assert.Equal(expected.Gamma, actual.Gamma);
        }
        public void Calculate_AppliesEffectOnHeightMap(double gamma)
        {
            // Arrange
            var data = new double[, ] {
                { 0d, 0.25d, 0.5d, 0.75d, 1d }
            };
            var heightMap = new HeightMap(data);
            var expected  = MockImageEffect(heightMap, gamma);
            var effect    = new GammaEffect(gamma);

            // Act
            var actual = effect.Calculate(heightMap).Data;

            // Assert
            Assert.Equal(expected[0, 0], actual[0, 0]);
            Assert.Equal(expected[0, 1], actual[0, 1]);
            Assert.Equal(expected[0, 2], actual[0, 2]);
            Assert.Equal(expected[0, 3], actual[0, 3]);
            Assert.Equal(expected[0, 4], actual[0, 4]);
        }