예제 #1
0
        public void ShouldDisplayReleasesNewerThanDate()
        {
            // TODO: Should this be DisplayReleasesForTheLastThreeMonths?


            //given
            DateTime dateTo = new DateTime(2012, 01, 21);
            IEnumerable <Release> expectedReleases = new List <Release>
            {
                new Release("Enzo", "REL1216", dateTo.AddDays(1)),
            };

            //when
            var releaseRepository = new Mock <IReleaseRepository>();

            releaseRepository.Setup(x => x.GetReleases(dateTo)).Returns(expectedReleases);

            var        releaseController = new ReleaseController(releaseRepository.Object);
            ViewResult result            = releaseController.ReleaseByDate(dateTo.Year, dateTo.Month, dateTo.Day);
            var        model             = (IEnumerable <Release>)result.ViewData.Model;

            //then
            Assert.That(result.ViewName, Is.EqualTo("Release"));
            Assert.That(model, Is.EqualTo(expectedReleases));
        }
예제 #2
0
        public void ShouldDisplayReleases()
        {
            IEnumerable <ReleaseDetailsModel> expectedReleaseModel = new List <ReleaseDetailsModel>
            {
                new ReleaseDetailsModel("Enzo", "REL1216", new DateTime(2011, 10, 20)),
                new ReleaseDetailsModel("Enzo", "REL54164", new DateTime(2011, 11, 20)),
                new ReleaseDetailsModel("Enzo", "REL123", new DateTime(2011, 03, 20)),
                new ReleaseDetailsModel("Enzo", "REL124", new DateTime(2011, 02, 27)),
                new ReleaseDetailsModel("Enzo", "REL125", new DateTime(2011, 09, 26)),
                new ReleaseDetailsModel("Colombo", "REL1000", new DateTime(2011, 12, 25)),
                new ReleaseDetailsModel("Colombo", "REL11122", new DateTime(2011, 11, 04))
            };

            var releaseRepository = new Mock <IReleaseRepository>();

            releaseRepository.Setup(x => x.GetReleases()).Returns(expectedReleaseModel);
            var        releaseController = new ReleaseController(releaseRepository.Object);
            ViewResult result            = releaseController.Index();

            var model = (IEnumerable <ReleaseDetailsModel>)result.ViewData.Model;

            Assert.That(result.ViewName, Is.EqualTo("Release"));
            Assert.That(model, Is.EqualTo(expectedReleaseModel));
            Assert.That(model.First().TeamName, Is.EqualTo("Enzo"));
        }
        public async Task <IActionResult> PerformMassRelease()
        {
            var releaseController = new ReleaseController();
            var result            = ((ObjectResult)await releaseController.Get()).Value;
            var pipelines         = (List <IO.Swagger.Models.ReleaseInfo>)result;
            var fromEnv           = "SDTTEST";
            var toEnv             = "SDTUAT";

            return(new OkObjectResult("Disabled"));

            foreach (var pipeline in pipelines)
            {
                var fromEnvironment = pipeline.Environments.SingleOrDefault(x => x.Name == fromEnv);
                var toEnvironment   = pipeline.Environments.SingleOrDefault(x => x.Name == toEnv);

                if (pipeline.ProjectName == "Shared" || fromEnvironment == null || toEnvironment == null)
                {
                    continue;
                }

                await releaseController.PerformMassRelease("Enterprise%20Service%20Bus", fromEnvironment.ReleaseId, toEnvironment.DefinitionEnvironmentId);
            }

            return(new OkObjectResult($"Release from {fromEnv} to {toEnv} Triggered"));
        }
예제 #4
0
        public void ShouldDisplayLastFiveReleasesOrderedByDate()
        {
            //given
            IEnumerable <Release> expectedReleases = new List <Release>
            {
                new Release("Enzo", "REL4", DateTime.Today.AddMonths(-1).AddDays(2)),
                new Release("Enzo", "REL5", DateTime.Today.AddMonths(-1).AddDays(1)),
                new Release("Bob", "REL6", DateTime.Today.AddMonths(-1)),
                new Release("Enzo", "REL1", DateTime.Today.AddMonths(-2)),
                new Release("Phoenix", "REL2", DateTime.Today.AddMonths(-2)),
                new Release("Fire", "REL3", DateTime.Today.AddMonths(-2))
            };

            //when
            var releaseRepository = new Mock <IReleaseRepository>();

            releaseRepository.Setup(x => x.GetLastFiveReleases()).Returns(expectedReleases);

            var        dashboardController = new ReleaseController(releaseRepository.Object);
            ViewResult result = dashboardController.LastFiveReleases();
            var        model  = (IEnumerable <Release>)result.ViewData.Model;

            //then
            Assert.That(result.ViewName, Is.EqualTo("ReleaseSummary"));
            Assert.That(model, Is.EqualTo(expectedReleases));
        }
예제 #5
0
        public async void Patch_No_Errors()
        {
            ReleaseControllerMockFacade mock = new ReleaseControllerMockFacade();
            var mockResult = new Mock <UpdateResponse <ApiReleaseResponseModel> >();

            mockResult.SetupGet(x => x.Success).Returns(true);
            mock.ServiceMock.Setup(x => x.Update(It.IsAny <string>(), It.IsAny <ApiReleaseRequestModel>()))
            .Callback <string, ApiReleaseRequestModel>(
                (id, model) => model.Assembled.Should().Be(DateTimeOffset.Parse("1/1/1987 12:00:00 AM"))
                )
            .Returns(Task.FromResult <UpdateResponse <ApiReleaseResponseModel> >(mockResult.Object));
            mock.ServiceMock.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult <ApiReleaseResponseModel>(new ApiReleaseResponseModel()));
            ReleaseController controller = new ReleaseController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, new ApiReleaseModelMapper());

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = new DefaultHttpContext();

            var patch = new JsonPatchDocument <ApiReleaseRequestModel>();

            patch.Replace(x => x.Assembled, DateTimeOffset.Parse("1/1/1987 12:00:00 AM"));

            IActionResult response = await controller.Patch(default(string), patch);

            response.Should().BeOfType <OkObjectResult>();
            (response as OkObjectResult).StatusCode.Should().Be((int)HttpStatusCode.OK);
            mock.ServiceMock.Verify(x => x.Update(It.IsAny <string>(), It.IsAny <ApiReleaseRequestModel>()));
        }
예제 #6
0
        public async void BulkInsert_No_Errors()
        {
            ReleaseControllerMockFacade mock = new ReleaseControllerMockFacade();

            var mockResponse = new CreateResponse <ApiReleaseResponseModel>(new FluentValidation.Results.ValidationResult());

            mockResponse.SetRecord(new ApiReleaseResponseModel());
            mock.ServiceMock.Setup(x => x.Create(It.IsAny <ApiReleaseRequestModel>())).Returns(Task.FromResult <CreateResponse <ApiReleaseResponseModel> >(mockResponse));
            ReleaseController controller = new ReleaseController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, mock.ModelMapperMock.Object);

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = new DefaultHttpContext();

            var records = new List <ApiReleaseRequestModel>();

            records.Add(new ApiReleaseRequestModel());
            IActionResult response = await controller.BulkInsert(records);

            response.Should().BeOfType <OkObjectResult>();
            (response as OkObjectResult).StatusCode.Should().Be((int)HttpStatusCode.OK);
            var result = (response as OkObjectResult).Value as List <ApiReleaseResponseModel>;

            result.Should().NotBeEmpty();
            mock.ServiceMock.Verify(x => x.Create(It.IsAny <ApiReleaseRequestModel>()));
        }
예제 #7
0
        public void ShouldDisplayReleaseNumbersOfTheLastThreeMonths()
        {
            //given
            IEnumerable <ReleaseDetailsModel> expectedReleaseModel = new List <ReleaseDetailsModel>
            {
                new ReleaseDetailsModel("Enzo", "REL1216", new DateTime(2011, 10, 20)),
                new ReleaseDetailsModel("Enzo", "REL54164", new DateTime(2011, 10, 20)),
                new ReleaseDetailsModel("Colombo", "REL1000", new DateTime(2011, 10, 20))
            };

            //when
            var      releaseRepository = new Mock <IReleaseRepository>();
            DateTime dateNow           = new DateTime(2012, 01, 21);
            DateTime dateTo            = dateNow.AddMonths(-3);

            releaseRepository.Setup(x => x.GetReleases(dateTo)).Returns(expectedReleaseModel);
            var        releaseController = new ReleaseController(releaseRepository.Object);
            ViewResult result            = releaseController.ReleaseByDate(dateTo.Year, dateTo.Month, dateTo.Day);
            var        model             = (IEnumerable <ReleaseDetailsModel>)result.ViewData.Model;

            //then
            Assert.That(result.ViewName, Is.EqualTo("Release"));
            Assert.That(model, Is.EqualTo(expectedReleaseModel));
            Assert.That(model.First().TeamName, Is.EqualTo("Enzo"));
        }
예제 #8
0
        public void ShouldCreateReleaseWithPrePatEmail()
        {
            //given
            var releaseRepository = new Mock <IReleaseRepository>();
            var releaseController = new ReleaseController(releaseRepository.Object);

            //We'll need mocks (fake) of Context, Request and a fake PostedFile
            var postedfile = new Mock <HttpPostedFileBase>();
            var release    = new Release();

            //Someone is going to ask for Request.File and we'll need a mock (fake) of that.
            string expectedFileName          = "Enzo Pre-PAT release 19122011 ref REL11125.0.00";
            string expectedFileTypeExtension = ".msg";
            string savedFileName             = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                            String.Concat(expectedFileName, expectedFileTypeExtension));

            postedfile.Setup(f => f.ContentLength).Returns(8192);
            postedfile.Setup(f => f.FileName).Returns(String.Concat(expectedFileName, expectedFileTypeExtension));

            releaseRepository.Setup(m => m.SaveReleaseDetails(It.IsAny <Release>()));

            //when
            releaseController.Create(release, postedfile.Object);

            //Then
            releaseRepository.Verify(x => x.SaveReleaseDetails(It.IsAny <Release>()), Times.Once());
            postedfile.Verify(x => x.SaveAs(savedFileName), Times.Once());


            Assert.That(release.PrePatEmailFile.Name, Is.EqualTo(savedFileName));
            Assert.That(release.PrePatEmailFile.Length, Is.EqualTo(8192));
        }
        public async Task <IActionResult> CreateStoryDoneAPI()
        {
            var releaseController = new ReleaseController();
            var result            = ((ObjectResult)await releaseController.CreateStoryDoneAPI("Enterprise%20Service%20Bus")).Value;


            return(new OkObjectResult("Yay"));
        }
예제 #10
0
        public async Task <IActionResult> Compare(string from = "preprod", string to = "prod")
        {
            var releaseController = new ReleaseController();
            var result            = (ObjectResult)await releaseController.Compare(from, to);

            var dashboard = ToDashboard(result);

            Response.Headers.Add("Refresh", "30");
            return(View(dashboard));
        }
예제 #11
0
        public async Task <IActionResult> Index(string environment = null, int?definitionId = null)
        {
            var releaseController = new ReleaseController();
            var result            = (ObjectResult)await releaseController.Get(environment, definitionId);

            var dashboard = ToDashboard(result);

            Response.Headers.Add("Refresh", "30");
            return(View(dashboard));
        }
        public async Task <IActionResult> CreateRepo()
        {
            var releaseController = new ReleaseController();
            //var result = ((ObjectResult)await releaseController.CreateRepo("PaulTest", "Enterprise%20Service%20Bus", "AlertApi")).Value;
            //var repo = (GitRepository)result;

            var build = await releaseController.CloneBuild(48, "Enterprise%20Service%20Bus");

            return(new OkObjectResult("Yay"));
        }
예제 #13
0
        public async Task GetLatestRelease_NotFound()
        {
            var fileStorageService = new Mock <IFileStorageService>();

            fileStorageService
            .Setup(s => s.GetDeserialized <CachedReleaseViewModel>(It.IsAny <string>()))
            .ReturnsAsync(new NotFoundResult());

            var controller = new ReleaseController(fileStorageService.Object);
            var result     = await controller.GetLatestRelease("publication-a");

            Assert.IsType <NotFoundResult>(result.Result);
        }
예제 #14
0
        public void ShouldBeAbleToCreateRelease()
        {
            //given
            var releaseRepository = new Mock <IReleaseRepository>();
            var releaseController = new ReleaseController(releaseRepository.Object);

            //when
            var redirectToRouteResult = (RedirectToRouteResult)releaseController.Create(new Release(), null);

            //then
            Assert.That(redirectToRouteResult.RouteValues["Controller"], Is.EqualTo("Release"));
            Assert.That(redirectToRouteResult.RouteValues["Action"], Is.EqualTo("Index"));
        }
예제 #15
0
        public void DeleteRelease()
        {
            var releaseService = new Mock <IReleaseBusinessLayer>();

            releaseService.Setup(x => x.GetReleaseByID(1))
            .Returns(testrelease);

            var controller = new ReleaseController(releaseService.Object);

            IHttpActionResult actionResult = controller.DeleteRelease(1);

            Assert.IsInstanceOfType(actionResult, typeof(OkNegotiatedContentResult <Release>));
        }
예제 #16
0
        public void GetReleases()
        {
            var releaseService = new Mock <IReleaseBusinessLayer>();

            releaseService.Setup(x => x.GetReleases()).Returns(new List <Release>());

            var controller = new ReleaseController(releaseService.Object);

            IHttpActionResult actionResult = controller.GetReleases();
            var contentResult = actionResult as OkNegotiatedContentResult <List <Release> >;

            Assert.IsNotNull(contentResult.Content);
        }
예제 #17
0
        public void UpdateRelease()
        {
            var releaseService = new Mock <IReleaseBusinessLayer>();

            releaseService.Setup(x => x.GetReleaseByID(1)).Returns(testrelease);

            var controller = new ReleaseController(releaseService.Object);

            IHttpActionResult actionResult = controller.UpdateRelease(1, testrelease);
            var contentResult = actionResult as OkNegotiatedContentResult <Release>;

            Assert.IsNotNull(contentResult.Content);
            Assert.AreEqual(1, contentResult.Content.ReleaseID);
        }
예제 #18
0
        public void ShouldBeAbleToCreateRelease()
        {
            //given
            var releaseRepository = new Mock <IReleaseRepository>();
            var releaseController = new ReleaseController(releaseRepository.Object);

            //when
            var release = new Release();
            var redirectToRouteResult = (RedirectToRouteResult)releaseController.Create(release, null);

            //then
            releaseRepository.Verify(x => x.SaveReleaseDetails(release), Times.Once());
            Assert.That(redirectToRouteResult.RouteValues["Controller"], Is.EqualTo("Release"));
            Assert.That(redirectToRouteResult.RouteValues["Action"], Is.EqualTo("Index"));
        }
예제 #19
0
        public async void Get_Not_Exists()
        {
            ReleaseControllerMockFacade mock = new ReleaseControllerMockFacade();

            mock.ServiceMock.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult <ApiReleaseResponseModel>(null));
            ReleaseController controller = new ReleaseController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, mock.ModelMapperMock.Object);

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = new DefaultHttpContext();

            IActionResult response = await controller.Get(default(string));

            response.Should().BeOfType <StatusCodeResult>();
            (response as StatusCodeResult).StatusCode.Should().Be((int)HttpStatusCode.NotFound);
            mock.ServiceMock.Verify(x => x.Get(It.IsAny <string>()));
        }
예제 #20
0
        public async void Delete_Errors()
        {
            ReleaseControllerMockFacade mock = new ReleaseControllerMockFacade();
            var mockResult = new Mock <ActionResponse>();

            mockResult.SetupGet(x => x.Success).Returns(false);
            mock.ServiceMock.Setup(x => x.Delete(It.IsAny <string>())).Returns(Task.FromResult <ActionResponse>(mockResult.Object));
            ReleaseController controller = new ReleaseController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, mock.ModelMapperMock.Object);

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = new DefaultHttpContext();

            IActionResult response = await controller.Delete(default(string));

            response.Should().BeOfType <ObjectResult>();
            (response as ObjectResult).StatusCode.Should().Be((int)HttpStatusCode.UnprocessableEntity);
            mock.ServiceMock.Verify(x => x.Delete(It.IsAny <string>()));
        }
예제 #21
0
        public async void All_Not_Exists()
        {
            ReleaseControllerMockFacade mock = new ReleaseControllerMockFacade();

            mock.ServiceMock.Setup(x => x.All(It.IsAny <int>(), It.IsAny <int>())).Returns(Task.FromResult <List <ApiReleaseResponseModel> >(new List <ApiReleaseResponseModel>()));
            ReleaseController controller = new ReleaseController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, mock.ModelMapperMock.Object);

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = new DefaultHttpContext();

            IActionResult response = await controller.All(1000, 0);

            response.Should().BeOfType <OkObjectResult>();
            (response as OkObjectResult).StatusCode.Should().Be((int)HttpStatusCode.OK);
            var items = (response as OkObjectResult).Value as List <ApiReleaseResponseModel>;

            items.Should().BeEmpty();
            mock.ServiceMock.Verify(x => x.All(It.IsAny <int>(), It.IsAny <int>()));
        }
예제 #22
0
        public async void Update_NotFound()
        {
            ReleaseControllerMockFacade mock = new ReleaseControllerMockFacade();
            var mockResult = new Mock <UpdateResponse <ApiReleaseResponseModel> >();

            mockResult.SetupGet(x => x.Success).Returns(false);
            mock.ServiceMock.Setup(x => x.Update(It.IsAny <string>(), It.IsAny <ApiReleaseRequestModel>())).Returns(Task.FromResult <UpdateResponse <ApiReleaseResponseModel> >(mockResult.Object));
            mock.ServiceMock.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult <ApiReleaseResponseModel>(null));
            ReleaseController controller = new ReleaseController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, new ApiReleaseModelMapper());

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = new DefaultHttpContext();

            IActionResult response = await controller.Update(default(string), new ApiReleaseRequestModel());

            response.Should().BeOfType <StatusCodeResult>();
            (response as StatusCodeResult).StatusCode.Should().Be((int)HttpStatusCode.NotFound);
            mock.ServiceMock.Verify(x => x.Get(It.IsAny <string>()));
        }
예제 #23
0
        public async void Patch_Record_Not_Found()
        {
            ReleaseControllerMockFacade mock = new ReleaseControllerMockFacade();
            var mockResult = new Mock <ActionResponse>();

            mock.ServiceMock.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult <ApiReleaseResponseModel>(null));
            ReleaseController controller = new ReleaseController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, mock.ModelMapperMock.Object);

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = new DefaultHttpContext();

            var patch = new JsonPatchDocument <ApiReleaseRequestModel>();

            patch.Replace(x => x.Assembled, DateTimeOffset.Parse("1/1/1987 12:00:00 AM"));

            IActionResult response = await controller.Patch(default(string), patch);

            response.Should().BeOfType <StatusCodeResult>();
            (response as StatusCodeResult).StatusCode.Should().Be((int)HttpStatusCode.NotFound);
            mock.ServiceMock.Verify(x => x.Get(It.IsAny <string>()));
        }
예제 #24
0
        public async void Create_Errors()
        {
            ReleaseControllerMockFacade mock = new ReleaseControllerMockFacade();

            var mockResponse = new Mock <CreateResponse <ApiReleaseResponseModel> >(new FluentValidation.Results.ValidationResult());
            var mockRecord   = new ApiReleaseResponseModel();

            mockResponse.SetupGet(x => x.Success).Returns(false);

            mock.ServiceMock.Setup(x => x.Create(It.IsAny <ApiReleaseRequestModel>())).Returns(Task.FromResult <CreateResponse <ApiReleaseResponseModel> >(mockResponse.Object));
            ReleaseController controller = new ReleaseController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, mock.ModelMapperMock.Object);

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = new DefaultHttpContext();

            IActionResult response = await controller.Create(new ApiReleaseRequestModel());

            response.Should().BeOfType <ObjectResult>();
            (response as ObjectResult).StatusCode.Should().Be((int)HttpStatusCode.UnprocessableEntity);
            mock.ServiceMock.Verify(x => x.Create(It.IsAny <ApiReleaseRequestModel>()));
        }
예제 #25
0
        public void ShouldDisplayAllReleases()
        {
            // TODO: tests about different types of data should happen in the repository
            // like different teams and different dates
            IEnumerable <Release> expectedReleaseModel = new List <Release>
            {
                new Release("Enzo", "REL1216",
                            new DateTime(2011, 10, 20)),
            };

            var releaseRepository = new Mock <IReleaseRepository>();

            releaseRepository.Setup(x => x.GetReleases()).Returns(expectedReleaseModel);
            var        releaseController = new ReleaseController(releaseRepository.Object);
            ViewResult result            = releaseController.Index();

            var model = (IEnumerable <Release>)result.ViewData.Model;

            Assert.That(result.ViewName, Is.EqualTo("Release"));
            Assert.That(model, Is.EqualTo(expectedReleaseModel));
        }
예제 #26
0
        public void ShouldCreateReleaseWithoutPrePatEmail()
        {
            //given


            var releaseRepository = new Mock <IReleaseRepository>();
            var releaseController = new ReleaseController(releaseRepository.Object);

            var releaseDetailsModel = new Release()
            {
                ReleaseNumber         = "REL1216",
                ReleaseFiInstructions = "FI as Normal",
                TeamName             = "ENZO",
                ServiceNowTicketLink = "www.google.co.uk"
            };

            //when
            releaseController.Create(releaseDetailsModel, null);

            //then
            releaseRepository.Verify(x => x.SaveReleaseDetails(releaseDetailsModel));
        }
예제 #27
0
        public async Task GetLatestRelease()
        {
            var publicationId = Guid.NewGuid();
            var releaseId     = Guid.NewGuid();

            var fileStorageService = new Mock <IFileStorageService>();

            fileStorageService
            .Setup(
                s => s.GetDeserialized <CachedPublicationViewModel>(
                    "publications/publication-a/publication.json"
                    )
                )
            .ReturnsAsync(new CachedPublicationViewModel
            {
                Id = publicationId,
                LatestReleaseId = releaseId,
                Releases        = new List <ReleaseTitleViewModel>
                {
                    new ReleaseTitleViewModel
                    {
                        Id = releaseId
                    }
                }
            });

            fileStorageService
            .Setup(
                s => s.GetDeserialized <CachedReleaseViewModel>(
                    "publications/publication-a/latest-release.json"
                    )
                )
            .ReturnsAsync(new CachedReleaseViewModel
            {
                Id      = releaseId,
                Content = new List <ContentSectionViewModel>
                {
                    new ContentSectionViewModel
                    {
                        Content = new List <IContentBlockViewModel>
                        {
                            new HtmlBlockViewModel()
                        }
                    }
                }
            });

            var controller = new ReleaseController(fileStorageService.Object);

            var result = await controller.GetLatestRelease("publication-a");

            var releaseViewModel = result.Value;

            Assert.IsType <ReleaseViewModel>(releaseViewModel);
            Assert.True(releaseViewModel.LatestRelease);

            Assert.Single(releaseViewModel.Content);

            var contentSection = releaseViewModel.Content.First();

            Assert.Single(contentSection.Content);
            Assert.IsType <HtmlBlockViewModel>(contentSection.Content.First());

            var publication = releaseViewModel.Publication;

            Assert.Equal(publicationId, publication.Id);
        }