public async Task GetLeavingReasons_WithZeroData_ShouldReturnEmptyResults() { string errorMessagePrefix = "LeavingReasons GetLeavingReasons() method does not work properly."; var context = OmmDbContextInMemoryFactory.InitializeContext(); this.leavingReasonsService = new LeavingReasonsService(context); List <LeavingReasonDto> actualResults = await this.leavingReasonsService.GetLeavingReasons().ToListAsync(); Assert.True(actualResults.Count == 0, errorMessagePrefix + " " + "Count of returned leaving reasons is not correct"); }
public async Task GetLeavingReasons_WithDummyData_ShouldReturnCorrectResults() { string errorMessagePrefix = "LeavingReasons GetLeavingReasons() method does not work properly."; var context = OmmDbContextInMemoryFactory.InitializeContext(); await SeedData(context); this.leavingReasonsService = new LeavingReasonsService(context); List <LeavingReasonDto> actualResults = await this.leavingReasonsService.GetLeavingReasons().ToListAsync(); List <LeavingReasonDto> expectedResults = GetDummyData().To <LeavingReasonDto>().ToList(); for (int i = 0; i < expectedResults.Count; i++) { var expectedEntry = expectedResults[i]; var actualEntry = actualResults[i]; Assert.True(expectedEntry.Id == actualEntry.Id, errorMessagePrefix + " " + "Id is not returned properly."); Assert.True(expectedEntry.Reason == actualEntry.Reason, errorMessagePrefix + " " + "Reason is not returned properly."); } Assert.True(expectedResults.Count == actualResults.Count, errorMessagePrefix + " " + "Count of returned leaving reasons is not correct"); }
public LeavingReasonsListViewComponent(ILeavingReasonsService leavingReasonsService) { this.leavingReasonsService = leavingReasonsService; }