public void And_ModelIsValid_Then_RedirectToConfirmAndCompletePage()
        {
            var viewModel = _autoFixture.Create <MergeOverviewViewModel>();

            var result = MergeController.MergeOverview(viewModel) as RedirectToActionResult;

            result.ActionName.Should().Be(nameof(MergeController.ConfirmAndComplete));
        }
        public void And_ModelIsInvalid_Then_ReturnView()
        {
            MergeController.ModelState.AddModelError("Error", "Error message");

            var viewModel = _autoFixture.Build <MergeOverviewViewModel>().Create();

            var result = MergeController.MergeOverview(viewModel) as ViewResult;

            result.Model.Should().BeEquivalentTo(viewModel);
        }
        public void And_SessionIsSet_Then_MapViewModel()
        {
            var mergeRquest = _autoFixture.Build <MergeRequest>().Create();

            _mockMergeSessionService.Setup(ms => ms.GetMergeRequest())
            .Returns(mergeRquest);

            var viewResult = MergeController.MergeOverview() as ViewResult;

            var viewModel = viewResult.Model as MergeOverviewViewModel;

            viewModel.PrimaryEpaoId.Should().Be(mergeRquest.PrimaryEpao.Id);
            viewModel.PrimaryEpaoName.Should().Be(mergeRquest.PrimaryEpao.Name);
            viewModel.SecondaryEpaoId.Should().Be(mergeRquest.SecondaryEpao.Id);
            viewModel.SecondaryEpaoName.Should().Be(mergeRquest.SecondaryEpao.Name);
            viewModel.SecondaryEpaoEffectiveTo.Should().Be(mergeRquest.SecondaryEpaoEffectiveTo);
        }
        public void And_SessionIsNull_ThenMapViewModel()
        {
            var mergeRequest = new MergeRequest();

            mergeRequest.StartNewRequest();

            _mockMergeSessionService.Setup(ms => ms.GetMergeRequest())
            .Returns(mergeRequest);

            var viewResult = MergeController.MergeOverview() as ViewResult;

            var viewModel = viewResult.Model as MergeOverviewViewModel;

            viewModel.PrimaryEpaoId.Should().BeNull();
            viewModel.PrimaryEpaoName.Should().BeNull();
            viewModel.SecondaryEpaoId.Should().BeNull();
            viewModel.SecondaryEpaoName.Should().BeNull();
            viewModel.SecondaryEpaoEffectiveTo.Should().BeNull();
        }
        public void Then_GetMergeRequestFromSession()
        {
            MergeController.MergeOverview();

            VerifyGetMergeRequest();
        }