private void AddApplicationsToViewModel(InModerationApplicationsViewModel viewModel, List <ModerationApplicationSummary> applications)
 {
     foreach (var application in applications)
     {
         var applicationVm = CreateApplicationViewModel(application);
         viewModel.AddApplication(applicationVm);
     }
 }
        public async Task <InModerationApplicationsViewModel> GetInModerationApplicationsViewModel(string userId)
        {
            var applicationSummary = await _applicationApiClient.GetApplicationCounts(userId);

            var applications = await _applicationApiClient.GetInModerationApplications(userId);

            var viewModel = new InModerationApplicationsViewModel(userId, applicationSummary.NewApplications, applicationSummary.InProgressApplications, applicationSummary.ModerationApplications, applicationSummary.ClarificationApplications, applicationSummary.ClosedApplications);

            AddApplicationsToViewModel(viewModel, applications);
            return(viewModel);
        }
Пример #3
0
        public async Task When_getting_in_moderation_applications_the_applications_are_returned()
        {
            var userId            = _controller.User.UserId();
            var expectedViewModel = new InModerationApplicationsViewModel(userId, 1, 2, 3, 4, 5);

            _moderatorOrchestrator.Setup(x => x.GetInModerationApplicationsViewModel(userId)).ReturnsAsync(expectedViewModel);

            var result = await _controller.InModerationApplications();

            Assert.AreSame(expectedViewModel, result.Model);
        }