Ejemplo n.º 1
0
        public void AddDepositInDatabase_ShouldReturnDepositDetails()
        {
            DateTime date = DateTime.UtcNow;
            var      data = new List <Deposit>()
            {
                new Deposit(1, 1, "Georgi Georgiev", 7500, "In cheque", 1000, DateTime.UtcNow.ToString()),
                new Deposit(2, 2, "Ivan Ivanov", 5000, "Cash", 500, DateTime.UtcNow.ToString())
            }.AsQueryable();
            var mockSet = new Mock <DbSet <Deposit> >();

            mockSet.As <IQueryable <Deposit> >().Setup(m => m.Provider).Returns(data.Provider);
            mockSet.As <IQueryable <Deposit> >().Setup(m => m.Expression).Returns(data.Expression);
            mockSet.As <IQueryable <Deposit> >().Setup(m => m.ElementType).Returns(data.ElementType);
            mockSet.As <IQueryable <Deposit> >().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator());
            var mockContext = new Mock <banking_dbContext>();

            mockContext.Setup(c => c.Deposit).Returns(mockSet.Object);

            var service = new DepositController(mockContext.Object);

            data.ToList().ForEach(a => service.Add(a));

            var deposit = service.GetDepositDetails(1).First();

            Assert.AreEqual(1000, deposit.DipAmount);
        }
Ejemplo n.º 2
0
        //Run when "Show" button is clicked. Get information for debit, deposit and transfer of specified useraccount
        private void btnShow_Click(object sender, EventArgs e)
        {
            decimal b = Convert.ToDecimal(txtName.Text);

            dataGridView1.AutoGenerateColumns = false;
            dataGridView2.AutoGenerateColumns = false;
            dataGridView3.AutoGenerateColumns = false;
            dataGridView1.DataSource          = debitcontroller.GetDebitDetails(b);
            dataGridView2.DataSource          = depositcontroller.GetDepositDetails(b);
            dataGridView3.DataSource          = transfercontroller.GetTransferDetails(b);
        }