Ejemplo n.º 1
0
        public IActionResult GetLastCampaignProjects()
        {
            if (!locationService.IsCountryAllowed(Request.HttpContext.Connection.RemoteIpAddress))
            {
                return(Forbid());
            }

            var lastCampaign = campaignList.GetLastCampaign();

            return(Ok(projectList.GetProjectsAndCampaignUrlModel(lastCampaign)));
        }
Ejemplo n.º 2
0
        public void When_Getting_LastCampaign_GetLastCampaign_returns_LastCampaign()
        {
            var latestCampaign = new Campaign
            {
                Id = 1
            };

            repoMock
            .Setup(r => r.GetNewestCampaign())
            .Returns(latestCampaign);

            //Act
            var resultCampaign = campaignList.GetLastCampaign();

            //Assert
            Assert.Equal(latestCampaign.Id, resultCampaign.Id);
            repoMock.Verify(r => r.GetNewestCampaign(), Times.Once);
        }