Example #1
0
        public void ConvertBackThrowsException()
        {
            // Arrange
            var conv = new ForegroundColor();

            // Act

            // Assert
            ExceptionAssert.Throws<NotSupportedException>( () => conv.ConvertBack( null, null, null, null ) );
        }
Example #2
0
        public void ConvertInvalidValueResultsInUnset()
        {
            // Arrange
            var conv = new ForegroundColor();

            // Act
            object converted = conv.Convert( 123, null, null, null );

            // Assert
            Assert.AreEqual( DependencyProperty.UnsetValue, converted );
        }
Example #3
0
        public void LightGrayResultsInBlack()
        {
            // Arrange
            var conv = new ForegroundColor();

            // Act
            object color = conv.Convert( "cccccc", null, null, null );

            // Assert
            SolidColorBrush brush = color as SolidColorBrush;
            Assert.IsNotNull( brush );
            Assert.AreEqual( Colors.Black, brush.Color );
        }
Example #4
0
        public void DarkGrayResultsInWhite()
        {
            // Arrange
            var conv = new ForegroundColor();

            // Act
            object color = conv.Convert( "444444", null, null, null );

            // Assert
            SolidColorBrush brush = color as SolidColorBrush;
            Assert.IsNotNull( brush );
            Assert.AreEqual( Colors.White, brush.Color );
        }
Example #5
0
        public void BlackAndWhiteBackgroundsResultsInWhiteAndBlackForeground()
        {
            // Arrange
            var conv = new ForegroundColor();

            // Act
            object white = conv.Convert( "000000", null, null, null );
            object black = conv.Convert( "ffffff", null, null, null );

            // Assert
            SolidColorBrush brush = white as SolidColorBrush;
            Assert.IsNotNull( brush );
            Assert.AreEqual( Colors.White, brush.Color );

            brush = black as SolidColorBrush;
            Assert.IsNotNull( brush );
            Assert.AreEqual( Colors.Black, brush.Color );
        }