Пример #1
0
            public void ShouldThrowInvalidDataConversionExceptionIfNotTrueOrFalseValue()
            {
                // Arrange
                const string booleanString = "Not valid";

                var converter = new BooleanToStringValueConverter {
                    TrueValue = "Yes", FalseValue = "No"
                };

                // Act & Assert
                Should.Throw <InvalidDataConversionException>(() => converter.ConvertBack(booleanString));
            }
Пример #2
0
            public void ShouldConvertToFalseWhenFalseValue()
            {
                // Arrange
                const string booleanString = "No";
                const bool   expected      = false;

                var converter = new BooleanToStringValueConverter {
                    TrueValue = "Yes", FalseValue = booleanString
                };

                // Act
                bool converted = converter.ConvertBack(booleanString);

                // Assert
                converted.ShouldBe(expected);
            }