Esempio n. 1
0
        public void ShouldNotHaveErrors_name_isSet()
        {
            var command   = CommandFactory.AddProduct("Name", "descr", 1, 12);
            var validator = new AddProductCommandValidator();

            validator.ShouldNotHaveValidationErrorFor(c => c.Name, command);
        }
        public void Should_Not_Validate_Product_Without_Name()
        {
            var command = new AddProductCommand()
            {
                Price = 1,
                Stock = 0
            };
            var result = new AddProductCommandValidator(command).Validate();

            result.Success.Should().BeFalse();
            result.Messages.FirstOrDefault().Should().Be(ProductValidationMessages.NAME);
        }
        public void Should__Validate_Product()
        {
            var command = new AddProductCommand()
            {
                Name  = "TESTE",
                Price = 1,
                Stock = 0
            };
            var result = new AddProductCommandValidator(command).Validate();

            result.Success.Should().BeTrue();
            result.Messages.Any().Should().BeFalse();
        }
 public AddProductCommandValidatorTest()
 {
     validator = new AddProductCommandValidator();
 }
Esempio n. 5
0
 public void Setup()
 {
     _validator = new AddProductCommandValidator();
 }