コード例 #1
0
        public void InValidTrolleyQuantityShouldPassValidation()
        {
            //Arrange
            var quantity = new TrolleyQuantityDto
            {
                Quantity = -1,
                Name     = "TestProduct"
            };
            var validator = new TrolleyQuantityValidator();
            //Act
            var result = validator.TestValidate(quantity);

            //Assert
            result.ShouldHaveValidationErrorFor(i => i.Quantity);
        }
コード例 #2
0
        public void ValidTrolleyQuantityShouldPassValidation()
        {
            //Arrange
            var quantity = new TrolleyQuantityDto
            {
                Quantity = 10,
                Name     = "TestProduct"
            };
            var validator = new TrolleyQuantityValidator();
            //Act
            var result = validator.TestValidate(quantity);

            //Assert
            result.ShouldNotHaveAnyValidationErrors();
        }