示例#1
0
        public void TestBankAddGetUpdateDelete()
        {
            //Add-Get-Тест
            decimal? ammount = 2000;
            DateTime date    = DateTime.Now;

            Bank expectedBank = new Bank();

            expectedBank.Ammount = ammount;
            expectedBank.Date    = date;

            DataAccessBank bank = new DataAccessBank();

            bank.AddElement(expectedBank);
            var actualBank = bank.GetAll().Last();

            Assert.AreEqual(expectedBank, actualBank);

            //Update - Тест
            expectedBank         = actualBank;
            expectedBank.Ammount = 3000;
            bank.UpdateElement(expectedBank);
            actualBank = bank.GetElement(expectedBank.CodePayment);
            Assert.AreEqual(expectedBank, actualBank);

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

            bank.DeleteElement(actualBank);
            int actualCount = bank.GetAll().Count();

            Assert.AreEqual(expectedCount, actualCount);
        }
        public void TestBankAddGetUpdateDelete()
        {
            //Add-Get-Тест
            decimal? ammount = 2000;
            DateTime date = DateTime.Now;

            Bank expectedBank = new Bank();
            expectedBank.Ammount = ammount;
            expectedBank.Date = date;

            DataAccessBank bank = new DataAccessBank();
            bank.AddElement(expectedBank);
            var actualBank = bank.GetAll().Last();
            Assert.AreEqual(expectedBank, actualBank);

            //Update - Тест
            expectedBank = actualBank;
            expectedBank.Ammount = 3000;
            bank.UpdateElement(expectedBank);
            actualBank = bank.GetElement(expectedBank.CodePayment);
            Assert.AreEqual(expectedBank, actualBank);

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