Ejemplo n.º 1
0
        public void Test_Cheese_Validate_Cheese_Returns_True()
        {
            _cheese.Price          = 10;
            _cheese.BestBeforeDate = DateTime.Parse("2016-03-19");
            _cheese.DaysToSell     = 5;
            _cheese.Name           = "Good Cheese";
            _cheese.Type           = CheeseTypes.Aged;

            var cheeseValidator = Substitute.For <ICheeseValidator>();

            cheeseValidator.Validate(_cheese)
            .Returns(new Tuple <bool, ValidationErrorType>(true, ValidationErrorType.None));
            var validationResult = _cheese.Validate(cheeseValidator);

            Assert.IsTrue(validationResult.Item1);
            Assert.AreEqual(ValidationErrorType.None, (ValidationErrorType)validationResult.Item2);
        }