Beispiel #1
0
        public async Task ItReturnsAGroupWithProcessedBody()
        {
            // Arrange
            var processedGroup = new ProcessedGroupBuilder().Build();

            // Mocks
            _processedRepository.Setup(o => o.Get <Group>(It.IsAny <string>(), It.IsAny <List <Query> >()))
            .ReturnsAsync(new StockportWebapp.Http.HttpResponse((int)HttpStatusCode.OK, processedGroup, string.Empty));

            _loggedInHelper.Setup(_ => _.GetLoggedInPerson()).Returns(new LoggedInPerson());

            _configuration.Setup(_ => _.GetArchiveEmailPeriods())
            .Returns(new List <ArchiveEmailPeriod> {
                new ArchiveEmailPeriod {
                    NumOfDays = 1
                }
            });

            // Act
            var view = await _groupController.Detail("slug") as ViewResult;

            var model = view.ViewData.Model as GroupDetailsViewModel;

            // Assert
            model.Group.Name.Should().Be(processedGroup.Name);
            model.Group.Slug.Should().Be(processedGroup.Slug);
            model.Group.Address.Should().Be(processedGroup.Address);
            model.Group.Email.Should().Be(processedGroup.Email);
            model.Group.MapDetails.AccessibleTransportLink.Should().Be(processedGroup.MapDetails.AccessibleTransportLink);
        }