示例#1
0
        public void TestClientsAddGetUpdateDelete()
        {
            //Add-Get-Тест
            bool    bookOrBuy       = true;
            Clients expectedClients = new Clients();

            expectedClients.BookOrBuy = bookOrBuy;

            DataAccessClients basicReis = new DataAccessClients();

            basicReis.AddElement(expectedClients);
            var actualClients = basicReis.GetAll().Last();

            Assert.AreEqual(expectedClients, actualClients);

            //Update - Тест
            expectedClients           = actualClients;
            expectedClients.BookOrBuy = false;
            basicReis.UpdateElement(expectedClients);
            actualClients = basicReis.GetElement(expectedClients.CodeClient);
            Assert.AreEqual(expectedClients, actualClients);

            //Delete-Тест
            int expectedCount = basicReis.GetAll().Count() - 1;

            basicReis.DeleteElement(actualClients);
            int actualCount = basicReis.GetAll().Count();

            Assert.AreEqual(expectedCount, actualCount);
        }
示例#2
0
        //Завершение бронирования(покупка)
        public string FinishReserve(int numberOfClient)
        {
            var total = ClientsEntitie.GetAll().DefaultIfEmpty().SingleOrDefault(x => x.CodeClient == numberOfClient);

            if (total != null)
            {
                total.BookOrBuy = true;
                ClientsEntitie.UpdateElement(total);

                Bank tempBank = new Bank();
                tempBank.Ammount = total.Reis.BasicReis.Price;
                tempBank.Date    = total.Reis.Date;
                tempBank.Comment = String.Format("Платеж за билет на рейс {0}", total.CodeReis);
                BankEntitie.AddElement(tempBank);
                return(String.Format("Продан билет на рейс {0} в {1} на {2}", total.CodeReis, total.Reis.BasicReis.To.Trim(), total.Reis.Date));
            }
            else
            {
                return(String.Format("Клиент с таким номером не найден"));
            }
        }
        public void TestClientsAddGetUpdateDelete()
        {
            //Add-Get-Тест
            bool bookOrBuy = true;
            Clients expectedClients = new Clients();
            expectedClients.BookOrBuy = bookOrBuy;

            DataAccessClients basicReis = new DataAccessClients();
            basicReis.AddElement(expectedClients);
            var actualClients = basicReis.GetAll().Last();
            Assert.AreEqual(expectedClients, actualClients);

            //Update - Тест
            expectedClients = actualClients;
            expectedClients.BookOrBuy = false;
            basicReis.UpdateElement(expectedClients);
            actualClients = basicReis.GetElement(expectedClients.CodeClient);
            Assert.AreEqual(expectedClients, actualClients);

            //Delete-Тест
            int expectedCount = basicReis.GetAll().Count() - 1;
            basicReis.DeleteElement(actualClients);
            int actualCount = basicReis.GetAll().Count();
            Assert.AreEqual(expectedCount, actualCount);
        }