private static void TestNoDetentionScenario(RuleCalculationModeType calculationType) { calculateRequest = kernel.Get <ICalculateDetentionRequest>(); calculateRequest.RequestingFaculty = facultyService.Get().InternalList.First(); calculateRequest.RuleCalculationMode = kernel.Get <IRuleCalculationMode>(); calculateRequest.RuleCalculationMode.CalculationType = calculationType; calculateRequest.Student = studentService.Get().InternalList.Where(x => x.RollNumber == "001").First(); // Has no offence registered calculateRequest.DetentionStartTime = DateTime.Now; var response = detentionCalculatorService.CalculateDetention(calculateRequest); if (response != null) { throw new Exception("TestNoDetentionScenario failed. Student should not get detention since has no offence registered against him/her."); } else { Console.WriteLine("TestNoDetentionScenario Success."); } }
public void SetUp() { kernel = new StandardKernel(); kernel.Load(Assembly.GetExecutingAssembly()); studentService = kernel.Get <IStudentCRUDService>(); facultyService = kernel.Get <IFacultyCRUDService>(); calculateRequest = kernel.Get <ICalculateDetentionRequest>(); calculateRequest.RuleCalculationMode = kernel.Get <IRuleCalculationMode>(); calculateRequest.RequestingFaculty = facultyService.Get().InternalList.First(); detentionCalculatorService = kernel.Get <IDetentionCalculatorService>(); }