Exemplo n.º 1
0
        public async Task Add_Product()
        {
            var repo    = GetInMemoryProductRepository();
            var product = new StoreApp.BusinessLogic.Product()
            {
                ProductID = 1,
                Name      = "soap",
                Price     = 40.00M
            };

            //Person savedPerson = sut.Add(person);
            await repo.AddAsync(product);

            var foundProduct = await repo.GetAsync(1);

            Assert.Equal(1, foundProduct.ProductID);
            Assert.Equal("soap", foundProduct.Name);
            Assert.Equal(40.00M, foundProduct.Price);
        }
Exemplo n.º 2
0
        public async Task Get_AllProducts()
        {
            var repo     = GetInMemoryProductRepository();
            var product1 = new StoreApp.BusinessLogic.Product()
            {
                ProductID = 1,
                Name      = "soap",
                Price     = 40.00M
            };
            var product2 = new StoreApp.BusinessLogic.Product()
            {
                ProductID = 2,
                Name      = "shampoo",
                Price     = 50.00M
            };

            await repo.AddAsync(product1);

            await repo.AddAsync(product2);

            var foundProducts = await repo.GetAllAsync();

            Assert.Equal(2, foundProducts.Count());
        }