Esempio n. 1
0
        public void ApoClassReturnAllDataInCollection()
        {
            var service = new ApoSubClassService(_apoClassRepository, _apoSubClassRepository);

            var sut = service.GetAll();


            Assert.IsType <List <ApoSubClassDto> >(sut);
            Assert.Equal(sut.Count(), _apoSubClass.Count(x => x.IsActive == 1));
        }
Esempio n. 2
0
        public void ApoSubClassServiceReturnNullWhenCollectionNotExist()
        {
            var service = new ApoSubClassService(_apoClassRepository, _apoSubClassRepository);

            var resource = new ApoSubClassResourceParameter()
            {
                Page       = 2,
                PageSize   = 5,
                ApoClassId = 1,
                SearchText = "sossssss"
            };

            var sut = service.GetAll(resource);

            Assert.IsType <PagedList <IApoSubClassDataTranferObject> >(sut);
            Assert.True(!sut.List.Any());
        }
Esempio n. 3
0
        public void ApoSubClassReturnCorrectValueWhenAssignCriteria()
        {
            var service = new ApoSubClassService(_apoClassRepository, _apoSubClassRepository);

            var resource = new ApoSubClassResourceParameter()
            {
                Page       = 2,
                PageSize   = 5,
                ApoClassId = 1,
                SearchText = ""
            };

            var sut = service.GetAll(resource);

            Assert.IsType <PagedList <IApoSubClassDataTranferObject> >(sut);
            Assert.Equal(sut.CurrentPage, 2);
            Assert.Equal(sut.HasPrevious, true);
            Assert.Equal(sut.HasNext, sut.List.Count > (1 * 10));
        }
Esempio n. 4
0
        public void ApoSubClassServiceReturnCorrectListWhenAssingSearchtext()
        {
            var service = new ApoSubClassService(_apoClassRepository, _apoSubClassRepository);

            var resource = new ApoSubClassResourceParameter()
            {
                Page       = 2,
                PageSize   = 5,
                ApoClassId = 1,
                SearchText = "so"
            };

            var sut = service.GetAll(resource);

            Assert.IsType <PagedList <IApoSubClassDataTranferObject> >(sut);
            Assert.Equal(sut.CurrentPage, 2);
            Assert.Equal(sut.HasPrevious, true);
            Assert.Equal(sut.HasNext, sut.List.Count > (1 * 10));
            Assert.True(sut.List.All(x => x.Name.ToLowerInvariant().Contains("so")));
        }