public void ApoDepartmentReturnCorrectValueWhenCriteriaNull() { var service = new ApoDepartmentService(_apoDivisionRepository, _apoGroupRepository, _apoDepartmentRepository); var resource = new ApoDepartmentResourceParameter(1, 10, null, null, null); var sut = service.GetAll(resource); Assert.IsType <PagedList <IApoDepartmentDataTranferObject> >(sut); Assert.True(sut.List.All(x => x.IsActive == 1)); }
public void ApoDeptShouldReturnCorrectValue() { var service = new ApoDepartmentService(_apoDivisionRepository, _apoGroupRepository, _apoDepartmentRepository); var resource = new ApoDepartmentResourceParameter(1, 10, 1, 0, "a"); var sut = service.GetAll(resource); Assert.IsType <PagedList <IApoDepartmentDataTranferObject> >(sut); Assert.Equal(sut.List.Count, _apoDepartment.Count(x => x.GroupId == 0 && x.DivisionId == 1) > 10 ? 10 : _apoDepartment.Count(x => x.GroupId == 0 && x.DivisionId == 1)); Assert.True(sut.List.All(x => _apoGroup.Single(g => g.Id == x.GroupId).Name.Equals(x.GroupName) && _apoDivision.Single(d => d.Id == x.DivisionId).Name.Equals(x.DivisionName) && (x.Name.ToLowerInvariant().Contains("a") || x.Code.ToLowerInvariant().Contains("a")))); }