예제 #1
0
        public void Create_Employee_WithDefaultData()
        {
            string alias = "rogreen";
            ExpenseService service = new ExpenseService();
            Employee employee = service.GetEmployee(alias);

            Assert.IsNotNull(employee);
            Assert.AreEqual(alias, employee.Alias);
            Assert.AreNotEqual(0, service.GetCharges(employee.EmployeeId));
            Assert.AreNotEqual(0, service.GetExpenseReports(employee.EmployeeId));
        }
예제 #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);
        }