Exemplo n.º 1
0
        public async void ApprenticeApi_ProviderHasFeedback_FeedbackDisplayed_InViewModel()
        {
            // Arrange
            var uniqueCode = Guid.NewGuid();
            var feedback   = Fixture.Create <Feedback>();

            _providerFeedbackRepoMock.Setup(mock => mock.GetProviderFeedbackAsync(It.IsAny <long>())).ReturnsAsync(feedback);

            // Act
            var result = await _controller.Index(uniqueCode) as ViewResult;

            // Assert
            var viewModel = Assert.IsAssignableFrom <ConfirmationViewModel>(result.Model);

            Assert.NotNull(viewModel.Feedback);
            viewModel.FeedbackRating.Should().Be(_cachedSurveyModel.Rating);
            viewModel.ProviderName.Should().Be(_cachedSurveyModel.ProviderName);
            viewModel.FatProviderSearch.ToLowerInvariant().Should().Be(Path.Combine(_externalLinks.FindApprenticeshipTrainingSiteUrl, "provider", "search").ToLowerInvariant());
        }
Exemplo n.º 2
0
        public void ConfirmationControllerTests_Index_InValidData()
        {
            var controller  = new ConfirmationController();
            var httpContext = new DefaultHttpContext();
            var tempData    = new TempDataDictionary(httpContext, Mock.Of <ITempDataProvider>());

            controller.TempData = tempData;

            var result = controller.Index();

            result.Should().BeOfType(typeof(ViewResult));
            var modelresult = ((ViewResult)result).Model;

            modelresult.Should().BeNull();
        }
Exemplo n.º 3
0
        public async void ApprenticeApi_ProviderHasFeedback_FeedbackDisplayed_InViewModel()
        {
            // Arrange
            var encodedAccountId = "ABCDEFG";

            // Act
            var result = await _controller.Index(encodedAccountId) as ViewResult;

            // Assert
            var viewModel = Assert.IsAssignableFrom <ConfirmationViewModel>(result.Model);

            viewModel.FeedbackRating.Should().Be(_cachedSurveyModel.Rating);
            viewModel.ProviderName.Should().Be(_cachedSurveyModel.ProviderName);
            viewModel.FatUrl.ToLowerInvariant().Should().Be(_externalLinks.FindApprenticeshipTrainingSiteUrl.ToLowerInvariant());
            viewModel.EmployerAccountsHomeUrl.Should().Be($"http://AnAccountsLink/{encodedAccountId}");
        }
Exemplo n.º 4
0
        public void ConfirmationControllerTests_Index_ValidData()
        {
            var controller = new ConfirmationController();

            var httpContext = new DefaultHttpContext();
            var tempData    = new TempDataDictionary(httpContext, Mock.Of <ITempDataProvider>());

            tempData["ilrSubmission"] = JsonConvert.SerializeObject(new IlrFileViewModel());
            controller.TempData       = tempData;

            var result = controller.Index();

            result.Should().BeOfType(typeof(ViewResult));
            var modelresult = ((ViewResult)result).Model;

            Assert.IsAssignableFrom <IlrFileViewModel>(modelresult);
        }