public void ShouldNotHaveErrors_name_isSet() { var command = CommandFactory.AddProduct("Name", "descr", 1, 12); var validator = new AddProductCommandValidator(); validator.ShouldNotHaveValidationErrorFor(c => c.Name, command); }
public async Task CanAddProduct() { const int CatIt = 1; const int Price = 10; const string Name = "name"; const string Description = "descr"; var command = CommandFactory.AddProduct(Name, Description, CatIt, Price); int productId = await new AddProductRequestHandler(context, mapper).Handle(command); var actual = await context.Products.SingleOrDefaultAsync(p => p.Id == productId); Assert.NotNull(actual); Assert.AreEqual(CatIt, actual.CategoryId); Assert.AreEqual(Price, actual.Price); Assert.AreEqual(Name, actual.Name); Assert.AreEqual(Description, actual.Description); }