public void DefaultConstructorSetsContrastFactorToDefault()
        {
            // Arrange

            // Act
            var backdrop = new BackdropSettings();

            // Assert
            Assert.Equal(0.75f, backdrop.ContrastFactor);
        }
        public void DefaultConstructorSetsHeightToDefault()
        {
            // Arrange

            // Act
            var backdrop = new BackdropSettings();

            // Assert
            Assert.Equal(473, backdrop.Height);
        }
        public void DefaultConstructorSetsBrightnessFactorToDefault()
        {
            // Arrange

            // Act
            var backdrop = new BackdropSettings();

            // Assert
            Assert.Equal(-0.05f, backdrop.BrightnessFactor);
        }
        public void DefaultConstructorResultsInvalidObject()
        {
            // Arrange
            var backdrop = new BackdropSettings();

            // Act

            // Assert
            Assert.True(IsValid(backdrop));
        }
        public void DefaultConstructorSetsNumberOfDominantColorsToDefault()
        {
            // Arrange

            // Act
            var backdrop = new BackdropSettings();

            // Assert
            Assert.Equal(5, backdrop.NumberOfDominantColors);
        }
        public void DefaultConstructorSetsOverlayColorToDefault()
        {
            // Arrange

            // Act
            var backdrop = new BackdropSettings();

            // Assert
            Assert.Equal(127, backdrop.OverlayColor.A);
            Assert.Equal(48, backdrop.OverlayColor.R);
            Assert.Equal(50, backdrop.OverlayColor.G);
            Assert.Equal(51, backdrop.OverlayColor.B);
        }
 private static bool IsValid(BackdropSettings backdrop)
 {
     return Validator.TryValidateObject(backdrop, new ValidationContext(backdrop), null, true);
 }
        public void WidthOutOrRangeResultsInInvalidObject(int invalidWidth)
        {
            // Arrange
            var backdrop = new BackdropSettings();

            // Act
            backdrop.Width = invalidWidth;

            // Assert
            Assert.False(IsValid(backdrop));
        }
        public void ConstructorWithInvalidSettingsThrowsValidationException()
        {
            // Arrange
            var backdropSettings = new BackdropSettings { NumberOfDominantColors = 0 };

            // Act

            // Assert
            Assert.Throws<ValidationException>(() => new Backdrop(new Bitmap(1, 1), backdropSettings));
        }
        public void DefaultConstructorSetsVerticalCenterOfGravityToDefault()
        {
            // Arrange

            // Act
            var backdrop = new BackdropSettings();

            // Assert
            Assert.Equal(0.16f, backdrop.VerticalCenterOfGravity);
        }
        public void VerticalCenterOfGravityInRangeResultsInValidObject(float validVerticalCenterOfGravity)
        {
            // Arrange
            var backdrop = new BackdropSettings();

            // Act
            backdrop.VerticalCenterOfGravity = validVerticalCenterOfGravity;

            // Assert
            Assert.True(IsValid(backdrop));
        }
        public void NumberOfDominantColorsOutOrRangeResultsInInvalidObject(int invalidNumberOfDominantColors)
        {
            // Arrange
            var backdrop = new BackdropSettings();

            // Act
            backdrop.NumberOfDominantColors = invalidNumberOfDominantColors;

            // Assert
            Assert.False(IsValid(backdrop));
        }
        public void NumberOfDominantColorsInRangeResultsInValidObject(int validNumberOfDominantColors)
        {
            // Arrange
            var backdrop = new BackdropSettings();

            // Act
            backdrop.NumberOfDominantColors = validNumberOfDominantColors;

            // Assert
            Assert.True(IsValid(backdrop));
        }
        public void HeightOutOrRangeResultsInInvalidObject(int invalidHeight)
        {
            // Arrange
            var backdrop = new BackdropSettings();

            // Act
            backdrop.Height = invalidHeight;

            // Assert
            Assert.False(IsValid(backdrop));
        }
        public void HeightInRangeResultsInValidObject(int validHeight)
        {
            // Arrange
            var backdrop = new BackdropSettings();

            // Act
            backdrop.Height = validHeight;

            // Assert
            Assert.True(IsValid(backdrop));
        }
        public void VerticalCenterOfGravityOutOrRangeResultsInInvalidObject(float invalidVerticalCenterOfGravity)
        {
            // Arrange
            var backdrop = new BackdropSettings();

            // Act
            backdrop.VerticalCenterOfGravity = invalidVerticalCenterOfGravity;

            // Assert
            Assert.False(IsValid(backdrop));
        }
        public void WidthInRangeResultsInValidObject(int validWidth)
        {
            // Arrange
            var backdrop = new BackdropSettings();

            // Act
            backdrop.Width = validWidth;

            // Assert
            Assert.True(IsValid(backdrop));
        }
        public void DefaultConstructorSetsWidthToDefault()
        {
            // Arrange

            // Act
            var backdrop = new BackdropSettings();

            // Assert
            Assert.Equal(1920, backdrop.Width);
        }
        public void ConstructorWithSettingsWillUsePassedSettings()
        {
            // Arrange
            var backdropSettings = new BackdropSettings();

            // Act
            var backdrop = new Backdrop(new Bitmap(2000, 1000), backdropSettings);

            // Assert
            Assert.Equal(backdropSettings.Width, backdrop.Settings.Width);
            Assert.Equal(backdropSettings.Height, backdrop.Settings.Height);
            Assert.Equal(backdropSettings.VerticalCenterOfGravity, backdrop.Settings.VerticalCenterOfGravity);
            Assert.Equal(backdropSettings.BrightnessFactor, backdrop.Settings.BrightnessFactor);
            Assert.Equal(backdropSettings.ContrastFactor, backdrop.Settings.ContrastFactor);
            Assert.Equal(backdropSettings.NumberOfDominantColors, backdrop.Settings.NumberOfDominantColors);
            Assert.Equal(backdropSettings.OverlayColor.A, backdrop.Settings.OverlayColor.A);
            Assert.Equal(backdropSettings.OverlayColor.R, backdrop.Settings.OverlayColor.R);
            Assert.Equal(backdropSettings.OverlayColor.G, backdrop.Settings.OverlayColor.G);
            Assert.Equal(backdropSettings.OverlayColor.B, backdrop.Settings.OverlayColor.B);
        }