Exemplo n.º 1
0
        public void ApoDivisionServiceShouldReturnAllItem()
        {
            var service = new ApoDivisionService(_apoDivisionRepository, _apoGroupService);

            var sut = service.GetAll();

            Assert.IsType <List <ApoDivisionDto> >(sut);
            Assert.Equal(sut.Count(), _apoDivision.Count());
        }
Exemplo n.º 2
0
        public void ApoDivisionServiceShouldReturnNullWhenAssignNoExistNameOrCodeInDatabase()
        {
            var service = new ApoDivisionService(_apoDivisionRepository, _apoGroupService);

            var sut = service.GetAll(1, 5, "ddsifjdigjs");


            Assert.IsType <PagedList <IApoDivisionDataTranferObject> >(sut);
            Assert.Equal(sut.List.Count, 0);
        }
Exemplo n.º 3
0
        public void ApoDivisionServiceShouldReturnNullWhenAssignInCorrectPage()
        {
            var service = new ApoDivisionService(_apoDivisionRepository, _apoGroupService);

            var sut = service.GetAll(10, 5, null);


            Assert.IsType <PagedList <IApoDivisionDataTranferObject> >(sut);
            Assert.Equal(sut.List.Count, 0);
        }
Exemplo n.º 4
0
        public void ApoDivisionServiceShouldReturnCorrect()
        {
            var service = new ApoDivisionService(_apoDivisionRepository, _apoGroupService);

            var sut = service.GetAll(1, 10, null);

            Assert.Equal(sut.CurrentPage, 1);
            Assert.Equal(sut.HasNext, false);
            Assert.Equal(sut.HasPrevious, false);
            Assert.True(sut.List.Count() <= 10);
            Assert.True(sut.List.All(x => x.IsActive == 1));
            Assert.IsType <PagedList <IApoDivisionDataTranferObject> >(sut);
        }
Exemplo n.º 5
0
        public void ApoDivisionServiceShouldReturnCorrectValueWhenAssignExistNameOrCodeInDatabase()
        {
            var service = new ApoDivisionService(_apoDivisionRepository, _apoGroupService);

            var sut = service.GetAll(1, 5, "Food");


            Assert.IsType <PagedList <IApoDivisionDataTranferObject> >(sut);
            Assert.True(sut.List.All(x => x.IsActive == 1));
            Assert.True(sut.List.Count > 0);
            Assert.True(sut.List.All(x => x.Code.Contains("Food") || x.Name.Contains("Food")));
            Assert.Equal(sut.List.Count, _apoDivision.Count(x => x.Code.ToLowerInvariant().Contains("Food".ToLowerInvariant()) ||
                                                            x.Name.ToLowerInvariant().Contains("Food".ToLowerInvariant())));
        }