Exemplo n.º 1
0
        public void GetProductByIdTest_GivesIdToListWhichDoesntContainSpecifiedId_ReturnsNull(int id)
        {
            ProductLibrary library  = new ProductLibrary();
            List <Product> products = new List <Product>();

            var product = new Product {
                Id = id
            };

            products.Add(product);
            Product result = library.GetProductById(id + 1, products);

            Assert.AreEqual(result, null);
        }
Exemplo n.º 2
0
        public void GetProductByIdTest_GivesId_ReturnsProductWithSpecifiedId(int id)
        {
            ProductLibrary library  = new ProductLibrary();
            List <Product> products = new List <Product>();

            var product = new Product {
                Id = id
            };

            products.Add(product);
            products.Add(new Product {
                Id = 2
            });
            products.Add(new Product {
                Id = 9
            });
            Product result = library.GetProductById(id, products);

            Assert.AreEqual(result.Id, product.Id);
        }