public void GetReports_SubmitedBySeveralUserInSameDepartment_DisplayedBySupervisor() { Consultant con1 = new Consultant("715b8401-6be0-4a63-9376-267909e79200"); Consultant con2 = new Consultant("089e814b-2315-4cfc-9316-85d2a495bd96"); Consultant con3 = new Consultant("6cb4e17b-f8d9-469a-84a7-424ac788afac"); Supervisor sup = new Supervisor("ff53c7ba-170f-47b3-9bd3-1a64287d157c"); // start transaction using (TransactionScope testTransaction = new TransactionScope()) { con1.CreateExpense(DateTime.Now, "", "", "", "", null); con1.AddExpenses(GetCurrentRowOfExpensesTable() + 1); con1.AddReport("con1"); con2.CreateExpense(DateTime.Now, "", "", "", "", null); con2.AddExpenses(GetCurrentRowOfExpensesTable() + 1); con2.AddReport("con2"); con3.CreateExpense(DateTime.Now, "", "", "", "", null); con3.AddExpenses(GetCurrentRowOfExpensesTable() + 1); con3.AddReport("con3"); ReportsTableAdapter adapter = new ReportsTableAdapter(); Reports.ReportsDataTable reportsTable = sup.GetReports(0); int counter = 1; foreach (Reports.ReportsRow report in reportsTable) { if (counter == 1) { Assert.AreEqual("con1", report.Report_name); Assert.AreEqual("715b8401-6be0-4a63-9376-267909e79200", report.Consultant_id); } else if (counter == 2) { Assert.AreEqual("con2", report.Report_name); Assert.AreEqual("089e814b-2315-4cfc-9316-85d2a495bd96", report.Consultant_id); } else { Assert.AreEqual("con3", report.Report_name); Assert.AreEqual("6cb4e17b-f8d9-469a-84a7-424ac788afac", report.Consultant_id); } counter++; } testTransaction.Dispose(); // rollback } }
public void GetReports_SubmitedByConsultantInDifferentDepartment_DisplayedBySupervisorInSameDepartment() { Consultant con_s1 = new Consultant("ce65a8ac-728b-405e-a00d-4a14e6ad23dc"); Consultant con_l1 = new Consultant("715b8401-6be0-4a63-9376-267909e79200"); Consultant con_he1 = new Consultant("4a4de22e-cd4f-4031-b0c1-126c3409dda3"); Supervisor sup_s1 = new Supervisor("1b52538c-ee54-425b-a3bc-e1b5cab1fdd3"); Supervisor sup_l1 = new Supervisor("ff53c7ba-170f-47b3-9bd3-1a64287d157c"); Supervisor sup_he1 = new Supervisor("c252413a-1f6c-4086-b35f-1e430f7d7a14"); // start transaction using (TransactionScope testTransaction = new TransactionScope()) { con_s1.CreateExpense(DateTime.Now, "", "", "", "", null); con_s1.AddExpenses(GetCurrentRowOfExpensesTable() + 1); con_s1.AddReport("con_s1"); con_l1.CreateExpense(DateTime.Now, "", "", "", "", null); con_l1.AddExpenses(GetCurrentRowOfExpensesTable() + 1); con_l1.AddReport("con_l1"); con_he1.CreateExpense(DateTime.Now, "", "", "", "", null); con_he1.AddExpenses(GetCurrentRowOfExpensesTable() + 1); con_he1.AddReport("con_he1"); ReportsTableAdapter adapter = new ReportsTableAdapter(); Reports.ReportsDataTable reportsTable = sup_s1.GetReports(0); foreach (Reports.ReportsRow report in reportsTable) { Assert.AreEqual("con_s1", report.Report_name); Assert.AreEqual("ce65a8ac-728b-405e-a00d-4a14e6ad23dc", report.Consultant_id); } adapter = new ReportsTableAdapter(); reportsTable = sup_l1.GetReports(0); foreach (Reports.ReportsRow report in reportsTable) { Assert.AreEqual("con_l1", report.Report_name); Assert.AreEqual("715b8401-6be0-4a63-9376-267909e79200", report.Consultant_id); } adapter = new ReportsTableAdapter(); reportsTable = sup_he1.GetReports(0); foreach (Reports.ReportsRow report in reportsTable) { Assert.AreEqual("con_he1", report.Report_name); Assert.AreEqual("4a4de22e-cd4f-4031-b0c1-126c3409dda3", report.Consultant_id); } testTransaction.Dispose(); // rollback } }