public void FindOneNonExist()
        {
            Bill bill = new Bill
            {
                Id          = 12,
                Type        = true,
                Text        = "Sber",
                Description = "Card",
                Balance     = 15000,
                Number      = "0397"
            };

            DbService.AddBill(bill);

            Bill test = new Bill
            {
                Id          = 13,
                Type        = false,
                Text        = "Sber",
                Description = "Card",
                Balance     = 15000
            };
            Bill result = DbService.FindBill(test.Id);

            Assert.IsNull(result);
        }
        public void AddTwoSame()
        {
            DbService.AddBill(new Bill
            {
                Id          = 2,
                Type        = true,
                Text        = "VTB",
                Description = "Card",
                Balance     = 15000,
                Number      = "5487"
            });
            DbService.AddBill(new Bill
            {
                Id          = 3,
                Type        = false,
                Text        = "Cash",
                Description = "",
                Balance     = 5000,
                Number      = ""
            });
            int count = DbService.LoadAllBills().Count;

            Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(2, count);
            DbService.RefrashDb();
            DbService.ClearAll();
        }
        public void FindOne()
        {
            Bill bill = new Bill
            {
                Id          = 11,
                Type        = true,
                Text        = "Sber",
                Description = "Card",
                Balance     = 15000,
                Number      = "0397"
            };

            DbService.AddBill(bill);

            Bill test = new Bill
            {
                Id          = 11,
                Type        = true,
                Text        = "Sber",
                Description = "Card",
                Balance     = 15000,
                Number      = "0397"
            };
            Bill result = DbService.FindBill(test.Id);

            Assert.AreEqual(Convert.ToUInt32(15000), result.Balance);
        }
Esempio n. 4
0
        public void LoadMany()
        {
            DbService.AddBill(new Bill
            {
                Id          = 13,
                Type        = true,
                Text        = "Sber",
                Description = "Card",
                Balance     = 15000,
                Number      = "0397"
            });
            DbService.AddBill(new Bill
            {
                Id          = 14,
                Type        = true,
                Text        = "VTB",
                Description = "Card",
                Balance     = 15000,
                Number      = "5487"
            });
            DbService.AddBill(new Bill
            {
                Id          = 15,
                Type        = false,
                Text        = "Cash",
                Description = "",
                Balance     = 5000,
                Number      = ""
            });

            var result = DbService.LoadAllBills();

            Assert.AreEqual(3, result.Count);
        }
Esempio n. 5
0
        public void EditNewOperation()
        {
            DbService.AddBill(new Bill
            {
                Id          = 10,
                Type        = true,
                Text        = "Sber",
                Description = "Card",
                Balance     = 15000,
                Number      = "0397"
            });
            DbService.AddCategory(new Category
            {
                Id   = 15,
                Name = "Продукты",
                Type = true
            });
            OperationDetailPage opPage = new OperationDetailPage(new Operation
            {
                Id       = 16,
                date     = new DateTime(2020, 3, 20),
                amount   = 300,
                category = DbService.FindCategory(15),
                bill     = DbService.FindBill(10),
                Comments = ""
            });

            opPage.picker.SelectedIndex     = 1;
            opPage.picker2.SelectedIndex    = 1;
            opPage.datePicker.DateSelected += opPage.datePicker_DateSelected;
            opPage.datePicker.Date          = new DateTime(2020, 3, 20);
            opPage.amountEntry.Text         = "546";
            opPage.commentsEntry.Text       = "";
            Assert.AreEqual("546", opPage.amountEntry.Text);
        }
        public void AddEmpty()
        {
            Bill bill = new Bill();

            DbService.AddBill(bill);
            int count = DbService.LoadAllBills().Count;

            Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(1, count);
            DbService.RefrashDb();
            DbService.ClearAll();
        }
        public void AddOneBill()
        {
            Bill bill = new Bill
            {
                Id          = 7,
                Type        = true,
                Text        = "Sber",
                Description = "Card",
                Balance     = 15000,
                Number      = "0397"
            };

            DbService.AddBill(bill);
            int count = DbService.LoadAllBills().Count;

            Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(count, 1);
            DbService.RefrashDb();
            DbService.ClearAll();
        }
Esempio n. 8
0
        public void RemoveOne()
        {
            Bill bill = new Bill
            {
                Id          = 16,
                Type        = true,
                Text        = "Sber",
                Description = "Card",
                Balance     = 15000,
                Number      = "0397"
            };

            DbService.AddBill(bill);

            DbService.RemoveBill(bill);
            int count = DbService.LoadAllBills().Count;

            Assert.AreEqual(0, count);
        }
        public void NonUpdateWoW2()
        {
            Bill bill = new Bill
            {
                Id          = 10,
                Type        = true,
                Text        = "Sber",
                Description = "Card",
                Balance     = 15000,
                Number      = "0397"
            };

            DbService.AddBill(bill);

            bill.Type = false;
            bool upstring = DbService.LoadAllBills().First().Type;

            Assert.AreEqual(false, upstring);
        }
        public void UpdateEmpty()
        {
            Bill bill = new Bill
            {
                Id          = 9,
                Type        = true,
                Text        = "Sber",
                Description = "Card",
                Balance     = 15000,
                Number      = "0397"
            };

            DbService.AddBill(bill);

            bill = null;
            DbService.UpdateBill(bill);
            string upstring = DbService.LoadAllBills().First().Description;

            Assert.AreEqual("Card", upstring);
        }
        public void AddListLinks()
        {
            Bill bill1 = new Bill
            {
                Id          = 4,
                Type        = true,
                Text        = "Sber",
                Description = "Card",
                Balance     = 15000,
                Number      = "0397"
            };
            Bill bill2 = new Bill
            {
                Id          = 5,
                Type        = true,
                Text        = "VTB",
                Description = "Card",
                Balance     = 15000,
                Number      = "5487"
            };
            Bill bill3 = new Bill
            {
                Id          = 6,
                Type        = false,
                Text        = "Cash",
                Description = "",
                Balance     = 5000,
                Number      = ""
            };

            DbService.AddBill(bill1);
            DbService.AddBill(bill2);
            DbService.AddBill(bill3);

            int count = DbService.LoadAllBills().Count;

            Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(3, count);
            DbService.RefrashDb();
            DbService.ClearAll();
        }
Esempio n. 12
0
        public void RemoveEmpty()
        {
            Bill bill = new Bill
            {
                Id          = 17,
                Type        = true,
                Text        = "Sber",
                Description = "Card",
                Balance     = 15000,
                Number      = "0397"
            };

            DbService.AddBill(bill);

            Bill empnote = null;

            DbService.RemoveBill(empnote);

            int count = DbService.LoadAllBills().Count;

            Assert.AreEqual(1, count);
        }