protected void btnSearchExpenses_Click(object sender, EventArgs e) { ExpenseReportDAL expenseReportDAL = new ExpenseReportDAL(); rptExpenseReport.DataSource = expenseReportDAL.GetExpenseReportsByConsultant((Guid)Membership.GetUser().ProviderUserKey, ddlSearchFilter.SelectedValue); rptExpenseReport.DataBind(); }
public void ExpenseReportDAL_GetReportByConsultant_StatusIsSubmitted_IsTrue() { using (TransactionScope testTransaction = new TransactionScope()) { ExpenseReportDAL expenseReportDAL = new ExpenseReportDAL(); List<ExpenseReport> reports = new List<ExpenseReport>(); ExpenseReport expenseReport = new ExpenseReport(); ExpenseItem item = new ExpenseItem(); Guid userId = new Guid("18b783f1-cb97-4e03-bb54-d3c41637b69c"); string status = ReportStatus.Submitted.ToString(); expenseReport.CreateDate = DateTime.Now; expenseReport.CreatedBy.UserId = new Guid("18b783f1-cb97-4e03-bb54-d3c41637b69c"); expenseReport.ExpenseToDept.DepartmentId = 1; expenseReport.CreatedBy.Dept.DepartmentId = 1; expenseReport.Status = ReportStatus.Submitted; item.ExpenseDate = DateTime.Now; item.Location = "Sydney"; item.Description = "AirTicket"; item.Amount = 5000; item.Currency = "AUD"; item.AudAmount = item.Amount; expenseReport.ExpenseItems.Add(item); expenseReportDAL.ProcessExpense(expenseReport); Assert.IsTrue(CheckDatabaseForExpenseId(expenseReport.ExpenseId), "Expense Id was not found in database"); reports = expenseReportDAL.GetExpenseReportsByConsultant(userId, status); Assert.IsTrue(reports.Count > 0, "No data in expense report"); testTransaction.Dispose(); } }