public void AddProduct_ProductAlreadyExists_ThrowException() { var product = ProductHelperTest.CreateProductExisting(); var ex = Assert.Throws <RepositoryException>(() => this.repository.Add(product)); Assert.That(ex.Message, Is.EqualTo("Produto 'CAMISA' já existe.")); }
public void UpdateProduct_ProductUpdatedAlreadyExists_ThrowException() { var product = ProductHelperTest.CreateProductValid(); this.repository.Add(product); var productUpdated = this.repository.GetAll()[1]; productUpdated.Description = "CAMISA"; var ex = Assert.Throws <RepositoryException>(() => this.repository.Update(productUpdated)); Assert.That(ex.Message, Is.EqualTo("Produto 'CAMISA' já existe.")); }
public void AddProduct_ProductIsValid_GetAllProductAdded() { var product = ProductHelperTest.CreateProductValid(); this.repository.Add(product); var products = this.repository.GetAll(); Assert.That(products.Count, Is.EqualTo(2)); Assert.That(products[0].Description, Is.EqualTo("CAMISA")); Assert.That(products[1].Description, Is.EqualTo("CAMISETA")); }