コード例 #1
0
        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));
        }
コード例 #2
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());
        }
コード例 #3
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")));
        }
コード例 #4
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));
        }