Ejemplo n.º 1
0
        public async Task Index_DefaultsToPage1()
        {
            var mockSvc = new Mock <ICollaborationService>();
            var result  = new CollaborationList();

            mockSvc.Setup(s => s.GetListAsync(1)).ReturnsAsync(result).Verifiable();
            var ctrlr = GetTestController(mockSvc.Object);

            var viewResult = await ctrlr.Index();

            Assert.True(ctrlr.IsInitialized);
            mockSvc.Verify(s => s.GetListAsync(1));
            Assert.True(viewResult is ViewResult);
            Assert.Equal(result, (viewResult as ViewResult).Model);
        }
Ejemplo n.º 2
0
        public async Task <CollaborationList> GetListAsync(int page = 1)
        {
            var sessions = await Client.GetSessionsList(_PageSize, _PageSize *(page - 1));

            var result = new CollaborationList()
            {
                Collaborations = new PagedResult <Collaboration>()
                {
                    Items        = sessions.Sessions.Select(p => ConvertToCollab(p)).ToList(),
                    TotalItems   = sessions.TotalCount,
                    CurrentPage  = page,
                    ItemsPerPage = _PageSize,
                },
                ShowStatus = true,
                ShowTimes  = false,
                ShowCreate = false
            };

            return(result);
        }