예제 #1
0
        public IActionResult GroupDelegates(int groupId, int page = 1)
        {
            var centreId  = User.GetCentreId();
            var groupName = groupsService.GetGroupName(groupId, centreId);

            if (groupName == null)
            {
                return(NotFound());
            }

            var groupDelegates = groupsService.GetGroupDelegates(groupId);

            var model = new GroupDelegatesViewModel(groupId, groupName, groupDelegates, page);

            return(View(model));
        }
예제 #2
0
        public void GroupDelegatesViewModel_should_correctly_return_the_second_page_of_delegates()
        {
            var model = new GroupDelegatesViewModel(
                1,
                "Group name",
                groupDelegates,
                2
                );

            using (new AssertionScope())
            {
                model.GroupId.Should().Be(1);
                model.NavViewModel.Should().BeEquivalentTo(expectedNavViewModel);
                model.GroupDelegates.Count().Should().Be(5);
                model.GroupDelegates.First().Name.Should().BeEquivalentTo("K Surname");
            }
        }
예제 #3
0
        public void GroupDelegatesViewModel_should_return_the_first_page_worth_of_delegates()
        {
            var model = new GroupDelegatesViewModel(
                1,
                "Group name",
                groupDelegates,
                1
                );

            using (new AssertionScope())
            {
                model.GroupId.Should().Be(1);
                model.NavViewModel.Should().BeEquivalentTo(expectedNavViewModel);
                model.GroupDelegates.Count().Should().Be(10);
                model.GroupDelegates.Any(groupDelegate => groupDelegate.Name == "K Surname").Should()
                .BeFalse();
            }
        }