Ejemplo n.º 1
0
        public async void HRServiceWorkflowPaginationOnly_GetQueryResultsAsync_Throw_MemberAccessException_On_Members_Null()
        {
            HRServiceWorkflowPaginationOnly <int> noRepo    = new HRServiceWorkflowPaginationOnly <int>(null, new HRPaginer <int>());
            HRServiceWorkflowPaginationOnly <int> noPaginer = new HRServiceWorkflowPaginationOnly <int>(new HRCoreRepositoryStub(), null);

            await Assert.ThrowsAsync <MemberAccessException>(async() => await noRepo.GetQueryResultsAsync(new PagingParameterInModel(), new HRSortingParamModel()));;
            await Assert.ThrowsAsync <MemberAccessException>(async() => await noPaginer.GetQueryResultsAsync(new PagingParameterInModel(), new HRSortingParamModel()));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Test that GetQueryResultsAsync throw NotSupportedException with a unsuortable repository and a valid orderBy
        /// </summary>
        public async void GetQueryResultsAsyncThrowNotSupportedExceptionOnUnsortableRepository()
        {
            HRCoreRepositoryStub repo = new HRCoreRepositoryStub();

            repo._isSortable = false;
            HRServiceWorkflowPaginationOnly <int> classic = new HRServiceWorkflowPaginationOnly <int>(repo, new HRPaginer <int>());

            await Assert.ThrowsAsync <NotSupportedException>(async() => await classic.GetQueryResultsAsync(new PagingParameterInModel(), new HRSortingParamModel()
            {
                SortingParamsQuery = "name;asc"
            }));;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Test that GetQueryResultsAsync with invalid PageModel throw InvalidProgramException
        /// </summary>
        public async void GetQueryResultsAsyncWithInvalidPageModelThrowInvalidProgramException()
        {
            HRCoreRepositoryStub repo = new HRCoreRepositoryStub();

            repo._isSortable  = true;
            repo._isPaginable = false;
            HRServiceWorkflowPaginationOnly <int> classic = new HRServiceWorkflowPaginationOnly <int>(repo, new HRPaginer <int>());
            await Assert.ThrowsAsync <InvalidProgramException>(async() => await classic.GetQueryResultsAsync(
                                                                   new PagingParameterInModel()
            {
                PageNumber = 500, PageSize = 10
            },
                                                                   new HRSortingParamModel()
            {
                SortingParamsQuery = "name;asc"
            }));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Test that GetQueryResultsAsync Retrun SortableAndPAginable from repo with a valid orderBy
        /// </summary>
        public async void GetQueryResultsAsyncRetrunRepositoryGetOrderedAndPaginatedsAsync()
        {
            HRCoreRepositoryStub repo = new HRCoreRepositoryStub();

            repo._isSortable = true;
            HRServiceWorkflowPaginationOnly <int> classic = new HRServiceWorkflowPaginationOnly <int>(repo, new HRPaginer <int>());
            Task <PagingParameterOutModel <int> > task    = classic.GetQueryResultsAsync(
                new PagingParameterInModel(),
                new HRSortingParamModel()
            {
                SortingParamsQuery = "name;asc"
            });
            await task;

            Assert.NotNull(task);
            Assert.NotNull(task.Result);
            Assert.Equal(42, task.Result.CurrentPage);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Test that GetQueryResultsAsync Retrun GetFullsAsync from unpaginable repo without ordering.
        /// /// </summary>
        public async void GetQueryResultsAsyncRetrunRepositoryGetFullsAsync()
        {
            HRCoreRepositoryStub repo = new HRCoreRepositoryStub();

            repo._isSortable  = true;
            repo._isPaginable = false;
            HRServiceWorkflowPaginationOnly <int> classic = new HRServiceWorkflowPaginationOnly <int>(repo, new HRPaginer <int>());
            Task <PagingParameterOutModel <int> > task    = classic.GetQueryResultsAsync(
                new PagingParameterInModel()
            {
                PageNumber = 0, PageSize = 10
            },
                null);
            await task;

            Assert.NotNull(task);
            Assert.NotNull(task.Result);
            Assert.NotNull(task.Result.PageItems);
            Assert.True(task.Result.PageItems.ToList()[0] == 45);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Test that GetQueryResultsAsync throw ArgumentNullException with a null pageModel
 /// </summary>
 public async void HRServiceWorkflowPaginationOnly_GetQueryResultsAsync_Throw_ArgumentNullException_With_Null_PageModel()
 {
     HRServiceWorkflowPaginationOnly <int> classic = new HRServiceWorkflowPaginationOnly <int>(new HRCoreRepositoryStub(), new HRPaginer <int>());
     await Assert.ThrowsAsync <ArgumentNullException>(async() => await classic.GetQueryResultsAsync(null, new HRSortingParamModel()));;
 }
Ejemplo n.º 7
0
 public HRServiceWorkflowPaginationOnlyTest()
 {
     _repo = new HRCoreRepositoryStub();
     _stubbedPagination = new HRServiceWorkflowPaginationOnly <int>(_repo, new HRPaginer <int>());
 }