public void ApoClassReturnAllDataInCollection() { var service = new ApoClassService(_apoClassRepository, _apoDepartmentRepository); var sut = service.GetAll(); Assert.IsType <List <ApoClassDto> >(sut); Assert.Equal(sut.Count(), _apoClass.Count(x => x.IsActive == 1)); }
public void ApoClassServiceReturnNullWhenCollectionNotExist() { var service = new ApoClassService(_apoClassRepository, _apoDepartmentRepository); var resource = new ApoClassResourceParameter() { Page = 100, PageSize = 10, SearchText = "na" }; var sut = service.GetAll(resource); Assert.IsType <PagedList <IApoClassDataTranferObject> >(sut); Assert.True(!sut.List.Any()); }
public void ApoClassServiceReturnCorrectListWhenAssingSearchtext() { var service = new ApoClassService(_apoClassRepository, _apoDepartmentRepository); var resource = new ApoClassResourceParameter() { Page = 1, PageSize = 10, SearchText = "na" }; var sut = service.GetAll(resource); Assert.IsType <PagedList <IApoClassDataTranferObject> >(sut); Assert.Equal(sut.CurrentPage, 1); Assert.Equal(sut.HasPrevious, false); Assert.Equal(sut.HasNext, sut.List.Count > (1 * 10)); Assert.True(sut.List.All(x => x.Name.ToLowerInvariant().Contains("na"))); }
public void ApoClassServiceShouldReturn() { var service = new ApoClassService(_apoClassRepository, _apoDepartmentRepository); var resource = new ApoClassResourceParameter() { Page = 1, PageSize = 10, ApoDepartmentId = 2, SearchText = "c" }; var sut = service.GetAll(resource); Assert.IsType <PagedList <IApoClassDataTranferObject> >(sut); Assert.Equal(sut.CurrentPage, 1); Assert.Equal(sut.HasPrevious, false); Assert.Equal(sut.HasNext, sut.List.Count > (1 * 10)); }