Exemplo n.º 1
0
        public async void GetAll_QueryResults_ItemsLength_IsLessOrEquals_PageSize()
        {
            var recommendationRepository = new ScenarioSummaryRepository(_mockDbContextFactory.Object);
            var model = new ScenarioSummaryQueryParams
            {
                PageSize  = 2,
                PageIndex = 1
            };

            var model2 = new ScenarioSummaryQueryParams
            {
                PageSize  = 10,
                PageIndex = 1
            };

            var results = await recommendationRepository.GetAll(model.Filters, model.Sorts, model.PageIndex, model.PageSize);

            Assert.Equal(results.Items.Count, results.PageSize);

            var results2 = await recommendationRepository.GetAll(model2.Filters, model.Sorts, model2.PageIndex, model2.PageSize);

            Assert.True(results2.Items.Count <= results2.PageSize);
        }
Exemplo n.º 2
0
        public async void GetAll_QueryResults_Items_CorrespondTo_PageIndex()
        {
            var recommendationRepository = new ScenarioSummaryRepository(_mockDbContextFactory.Object);
            var model = new ScenarioSummaryQueryParams
            {
                PageSize  = 1,
                PageIndex = 5
            };

            //This GetAll query should return only the FithItem in the List of set up recommendations.
            var resultsWithOnlyFithItem = await recommendationRepository.GetAll(model.Filters, model.Sorts, model.PageIndex, model.PageSize);

            Assert.True(resultsWithOnlyFithItem.Items[0].ScenarioName.Equals("ScenarioSummary5"));
        }