Exemplo n.º 1
0
        public void HTMLPresenterTest()
        {
            Goods      bread = new SpecialGoods("Bread");
            Item       i1    = new Item(bread, 10, 23);
            Customer   x     = new Customer("test", 0);
            IPresenter p     = new HTMLPresenter();
            Bill       b1    = new Bill(x, p);

            b1.addGoods(i1);
            string bill     = b1.statement();
            string expected = "Счет для test\nНазвание\t|Цена\t|Кол-во |Стоимость\t|Скидка\t|Сумма\t|Бонус\nBread\t\t|23\t|10\t|230\t\t|0\t|230\t|0\nСумма счета составляет 230\nВы заработали 0 бонусных балов";

            Assert.AreEqual(expected, bill);
        }
Exemplo n.º 2
0
        public void HTML_Presenter_test()
        {
            BillFactory   factory           = new BillFactory();
            Goods         cola              = factory.Create("Regular", "Cola");
            Goods         pepsi             = factory.Create("Sale", "Pepsi");
            int           price_for_fanta   = 45;
            int           price_for_snikers = 33;
            Item          i1    = new Item(cola, 2, price_for_fanta);
            Item          i2    = new Item(pepsi, 3, price_for_snikers);
            Customer      Denis = new Customer("Vadim&Volodya", 10);
            IPresenter    p     = new HTMLPresenter();
            BillGenerator b1    = new BillGenerator(Denis, p);

            b1.addGoods(i1);
            b1.addGoods(i2);
            string bill    = b1.GenerateBill();
            string actual  = bill;
            string exepted = b1.GenerateBill();

            Assert.AreEqual(exepted, actual);
        }