Beispiel #1
0
        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."));
        }
Beispiel #2
0
        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"));
        }