Esempio n. 1
0
        public void Validate_ValueIsNotValid_ReturnsIsValidFalse(object value, string whenTrue, string whenFalse)
        {
            var uut = new BooleanToStringValueConverterAndValidationRule()
            {
                WhenTrue  = whenTrue,
                WhenFalse = whenFalse
            };

            uut.Validate(value, null).IsValid.ShouldBeFalse();
        }
Esempio n. 2
0
        public void Validate_ValueIsNotValid_ReturnsErrorContentAsExpected(object value, string whenTrue, string whenFalse)
        {
            var uut = new BooleanToStringValueConverterAndValidationRule()
            {
                WhenTrue  = whenTrue,
                WhenFalse = whenFalse
            };

            var result = uut.Validate(value, null).ErrorContent;

            result.ShouldSatisfyAllConditions(
                () => result.ShouldBeOfType <string>(),
                () => (result as string)?.ShouldContain(whenTrue),
                () => (result as string)?.ShouldContain(whenFalse));
        }