Ejemplo n.º 1
0
        public void ItShouldAcceptValidNumeral(string input)
        {
            //Arrange
            Mock <IValidationRuleProvider <string> > mockRuleProvider = new Mock <IValidationRuleProvider <string> >();
            NumeralsValidator sut = new NumeralsValidator(mockRuleProvider.Object);

            //Act
            bool result = sut.Validate(input);

            //Assert
            Assert.True(result);
        }
Ejemplo n.º 2
0
        public void ItShouldReturnTrueIfAllValidationSucceeds(
            bool expected,
            string input)
        {
            //Arrange

            Mock <IValidationRule <string> > mockRule = new Mock <IValidationRule <string> >();

            mockRule.Setup(mockRule => mockRule.IsSatisfiedBy(input))
            .Returns(expected);

            Mock <IValidationRuleProvider <string> > mockRuleProvider = new Mock <IValidationRuleProvider <string> >();

            mockRuleProvider.Setup(mockRuleProvider => mockRuleProvider.GetRules())
            .Returns(new IValidationRule <string>[] { mockRule.Object });

            NumeralsValidator sut = new NumeralsValidator(mockRuleProvider.Object);

            //Act
            bool result = sut.Validate(input);

            //Assert
            Assert.True(result == expected);
        }