Ejemplo n.º 1
0
        public void SaleTest()
        {
            var books = new List <Book>()
            {
                new Book(1, "adventure", "fiction", true, 100, DateTime.Today),
                new Book(2, "adventure", "adventure", true, 100, DateTime.Today),
                new Book(3, "adventure", "encyclopedia", true, 100, DateTime.Today)
            };
            var tmpShop = new ShopLibrary(1, 3, 100);

            tmpShop.Books.AddRange(books);
            var system = new MarketSystem(tmpShop);

            system.BeginSale();
            foreach (var book in tmpShop.Books)
            {
                switch (book.Id)
                {
                case 1:
                    book.CurrentPrice.Should().Be(97);
                    break;

                case 2:
                    book.CurrentPrice.Should().Be(93);
                    break;

                case 3:
                    book.CurrentPrice.Should().Be(90);
                    break;
                }
            }

            system.EndSale();
            foreach (var book in tmpShop.Books)
            {
                book.CurrentPrice.Should().Be(100);
                break;
            }
        }
Ejemplo n.º 2
0
 public async Task EndSale()
 {
     await _marketSystem.EndSale();
 }