Esempio n. 1
0
        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());
        }
Esempio n. 2
0
        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")));
        }
Esempio n. 3
0
        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));
        }