コード例 #1
0
        public void Should_Return_Null_If_Converting_From_Visibility_To_Anything_Other_Than_Boolean()
        {
            // Given
            var converter = new BoolToVisibilityConverter();

            // When
            var result = converter.ConvertBack("Hello", null, null, null);

            // Then
            Assert.Null(result);
        }
コード例 #2
0
        public void Should_Return_Null_If_Converting_From_Unknown_Visibility_Value()
        {
            // Given
            var converter = new BoolToVisibilityConverter();

            // When
            var result = converter.ConvertBack((Visibility)255, null, null, null);

            // Then
            Assert.Null(result);
        }
コード例 #3
0
        public void Can_Convert_From_Visibility_To_Boolean(Visibility value, bool expected)
        {
            // Given
            var converter = new BoolToVisibilityConverter();

            // When
            var result = converter.ConvertBack(value, null, null, null);

            // Then
            Assert.NotNull(result);
            Assert.IsType<bool>(result);
            Assert.Equal(expected, (bool)result);
        }
コード例 #4
0
        public void Can_Convert_From_Boolean_To_Visibility(bool value, Visibility expected)
        {
            // Given
            var converter = new BoolToVisibilityConverter();

            // When
            var result = converter.Convert(value, null, null, null);

            // Then
            Assert.NotNull(result);
            Assert.IsType<Visibility>(result);
            Assert.Equal(expected, (Visibility)result);
        }