Exemplo n.º 1
0
        public async void TestSaveToOrder()
        {
            var stocklistService = new StocklistInMemoryService();
            var orderList        = new List <Order>();
            var order            = new Order();

            order.Id              = Guid.NewGuid();
            order.Name            = "Coca-Cola";
            order.Price           = 16M;
            order.PricePerProduct = 16M;
            order.TotalPrice      = 16M;
            await stocklistService.SaveToOrder(order);

            var result = stocklistService.GetOrderList().Result;

            Assert.NotEmpty(result);
        }
Exemplo n.º 2
0
        public async void TestCalculateTotalPriceOfOrderList()
        {
            var stocklistService = new StocklistInMemoryService();
            var orderList        = new List <Order>();
            var order            = new Order();

            order.Id              = Guid.NewGuid();
            order.Name            = "Coca-Cola";
            order.Price           = 16M;
            order.Amount          = 1;
            order.PricePerProduct = 16M;
            order.TotalPrice      = 16M;
            await stocklistService.SaveToOrder(order);

            var result = stocklistService.CalculateTotalPrice();

            Assert.Equal(16, result);
        }