Esempio n. 1
0
        private Charge AddRandomCharge(int employeeId)
        {
            Charge charge =
                new Charge()
                {
                    AccountNumber = this._random.Next(),
                    BilledAmount = this._random.Next(1000),
                    Category = this._random.Next(),
                    Description = this._random.Next().ToString(),
                    EmployeeId = employeeId,
                    ExpenseDate = DateTime.Today,
                    ExpenseType = this._random.Next(),
                    Location = this._random.Next().ToString(),
                    Merchant = this._random.Next().ToString(),
                    Notes = this._random.Next().ToString(),
                    ReceiptRequired = false,
                    TransactionAmount = this._random.Next(1000),
                };

            ExpenseService service = new ExpenseService();
            service.SaveCharge(charge);
            return charge;
        }
Esempio n. 2
0
        public void Create_ExpenseReport()
        {
            Employee employee = this.AddRandomEmployee();
            Charge charge1 = this.AddRandomCharge(employee.EmployeeId);
            Charge charge2 = this.AddRandomCharge(employee.EmployeeId);
            Charge charge3 = this.AddRandomCharge(employee.EmployeeId);

            ExpenseReport expenseReport =
                new ExpenseReport()
                {
                    Amount = 1,
                    Approver = "2",
                    CostCenter = 3,
                    EmployeeId = employee.EmployeeId,
                    Notes = "4",
                    Purpose = "5",
                    Status = 6,                    
                };

            ExpenseService service = new ExpenseService();
            service.SaveExpenseReport(expenseReport);
            Assert.AreNotEqual(0, expenseReport.ExpenseReportId);

            charge1.ExpenseReportId = expenseReport.ExpenseReportId;
            service.SaveCharge(charge1);
            charge2.ExpenseReportId = expenseReport.ExpenseReportId;
            service.SaveCharge(charge2);
            charge3.ExpenseReportId = expenseReport.ExpenseReportId;
            service.SaveCharge(charge3);

            List<Charge> charges = service.GetCharges(expenseReport.ExpenseReportId);
            Assert.AreEqual(3, charges.Count);
            Assert.AreEqual(charge1.ChargeId, charges[0].ChargeId);
            Assert.AreEqual(charge2.ChargeId, charges[1].ChargeId);
            Assert.AreEqual(charge3.ChargeId, charges[2].ChargeId);
        }
Esempio n. 3
0
        public void Create_Charge()
        {
            Employee employee = this.AddRandomEmployee();

            Charge charge =
                new Charge()
                {
                    AccountNumber = 0,
                    BilledAmount = 1,
                    Category = 2,
                    Description = "3",
                    EmployeeId = employee.EmployeeId,
                    ExpenseDate = new DateTime(2013, 9, 28),
                    ExpenseType = (int) ChargeType.Business,
                    Location = "4",
                    Merchant = "5",
                    Notes = "6",
                    ReceiptRequired = true,
                    TransactionAmount = 7,
                };

            ExpenseService service = new ExpenseService();

            int chargeId = service.SaveCharge(charge);

            Assert.AreNotEqual(0, chargeId);
            Assert.AreEqual(chargeId, charge.ChargeId);
        }