Пример #1
0
        public void GetProductsByName_GivesName_ReturnListOfProductsWithSpecifiedName()
        {
            ProductLibrary library  = new ProductLibrary();
            List <Product> products = new List <Product>();

            var product = new Product {
                Id = 1, Name = "Opona"
            };
            var product2 = new Product {
                Id = 2, Name = "Mleko"
            };

            products.Add(product);
            products.Add(product2);

            var result = library.GetProductsByName("Opona", products);

            Assert.AreEqual(result.Count(), 1);
        }
Пример #2
0
        public void GetProductsByName_GivesName_ReturnListOfProductsWithSpecifiedNameV2()
        {
            ProductLibrary library  = new ProductLibrary();
            var            products = new List <Product>
            {
                new Product {
                    Id = 1, Name = "Opona"
                },
                new Product {
                    Id = 2, Name = "Mleko"
                },
                new Product {
                    Id = 3, Name = "Opona"
                }
            };

            var result = library.GetProductsByName("Opona", products);

            Assert.AreEqual(result.Count(), 2);
        }