示例#1
0
        public void AddDisbursementDetailsForEachDepartmentTest_CorrectDepts()
        {
            // Arrange
            List <Requisition> reqList = new List <Requisition>();

            // Add Requisitions to List<Requisition>
            reqList.Add(context.Requisition.Where(x => x.RequisitionId == "GAB1").ToList().First());
            reqList.Add(context.Requisition.Where(x => x.RequisitionId == "GAB2").ToList().First());
            reqList.Add(context.Requisition.Where(x => x.RequisitionId == "GAB3").ToList().First());

            // Act
            List <Disbursement> disbList = requisitionService.CreateDisbursementForEachDepartment(reqList);

            //// Assert - There should be 3 Disbursements created, one for each department
            Assert.AreEqual(disbList.Count, 3);
            Assert.IsTrue(new HashSet <string>(disbList.Select(x => x.Department.DepartmentCode).ToList())
                          .SetEquals(new HashSet <string> {
                "COMM", "CPSC", "ENGL"
            }));
        }