public void DetailsSetsViewBagAbsoluteUrlToUrlEncodedUrlAction()
        {
            const string urlEncodedValue = "urlEncodedValue";

            var mockMediator = new Mock<IMediator>();
            mockMediator.Setup(x => x.Send(It.IsAny<CampaignByCampaignIdQuery>())).Returns(new Campaign());

            var sut = new CampaignControllerForDetailsActionMethod(mockMediator.Object, urlEncodedValue)
            {
                Url = new Mock<IUrlHelper>().Object
            };
            sut.SetDefaultHttpContext();

            sut.Details(It.IsAny<int>());

            Assert.Equal(urlEncodedValue, sut.ViewBag.AbsoluteUrl);
        }
        public void DetailsReturnsTheCorrectModel()
        {
            var mockMediator = new Mock <IMediator>();

            mockMediator.Setup(x => x.Send(It.IsAny <CampaignByCampaignIdQuery>())).Returns(new Campaign());

            var sut = new CampaignControllerForDetailsActionMethod(mockMediator.Object)
            {
                Url = new Mock <IUrlHelper>().Object
            };

            sut.SetDefaultHttpContext();

            var result = (ViewResult)sut.Details(It.IsAny <int>());

            Assert.IsType <CampaignViewModel>(result.ViewData.Model);
        }
        public async Task DetailsReturnsTheCorrectView()
        {
            var mockMediator = new Mock <IMediator>();

            mockMediator.Setup(x => x.SendAsync(It.IsAny <CampaignByCampaignIdQuery>())).ReturnsAsync(new Campaign());

            var sut = new CampaignControllerForDetailsActionMethod(mockMediator.Object)
            {
                Url = new Mock <IUrlHelper>().Object
            };

            sut.SetDefaultHttpContext();

            var result = await sut.Details(It.IsAny <int>()) as ViewResult;

            Assert.Equal("Details", result.ViewName);
        }
        public void DetailsSetsViewBagAbsoluteUrlToUrlEncodedUrlAction()
        {
            const string urlEncodedValue = "urlEncodedValue";

            var mockMediator = new Mock <IMediator>();

            mockMediator.Setup(x => x.Send(It.IsAny <CampaignByCampaignIdQuery>())).Returns(new Campaign());

            var sut = new CampaignControllerForDetailsActionMethod(mockMediator.Object, urlEncodedValue)
            {
                Url = new Mock <IUrlHelper>().Object
            };

            sut.SetDefaultHttpContext();

            sut.Details(It.IsAny <int>());

            Assert.Equal(urlEncodedValue, sut.ViewBag.AbsoluteUrl);
        }
        public void DetailsReturnsTheCorrectModel()
        {
            var mockMediator = new Mock<IMediator>();
            mockMediator.Setup(x => x.Send(It.IsAny<CampaignByCampaignIdQuery>())).Returns(new Campaign());

            var sut = new CampaignControllerForDetailsActionMethod(mockMediator.Object) { Url = new Mock<IUrlHelper>().Object };
            sut.SetDefaultHttpContext();

            var result = (ViewResult)sut.Details(It.IsAny<int>());

            Assert.IsType<CampaignViewModel>(result.ViewData.Model);
        }
        public async Task DetailsReturnsTheCorrectView()
        {
            var mockMediator = new Mock<IMediator>();
            mockMediator.Setup(x => x.SendAsync(It.IsAny<CampaignByCampaignIdQuery>())).ReturnsAsync(new Campaign());

            var sut = new CampaignControllerForDetailsActionMethod(mockMediator.Object) { Url = new Mock<IUrlHelper>().Object };
            sut.SetDefaultHttpContext();

            var result = await sut.Details(It.IsAny<int>()) as ViewResult;

            Assert.Equal("Details", result.ViewName);
        }