示例#1
0
        public void PoputlateLocationCookieWithSearchedLocation()
        {
            UserDataProvider.Setup(x => x.Get(UserDataItemNames.LastSearchedLocation)).Returns("TEST COOKIE LOCATION");

            var response = Mediator.Index(null, ApprenticeshipSearchMode.Keyword, false);

            response.AssertCode(ApprenticeshipSearchMediatorCodes.Index.Ok, true);
            response.ViewModel.Location.Should().Be("TEST COOKIE LOCATION");
            CandidateServiceProvider.Verify(x => x.GetCandidate(It.IsAny <Guid>()), Times.Never);
        }
示例#2
0
        public void PoputlateLocationWithUsersPostcode()
        {
            var candidate = new Candidate
            {
                RegistrationDetails = new RegistrationDetails {
                    Address = new Address {
                        Postcode = "CANDIDATE POSTCODE"
                    }
                }
            };

            CandidateServiceProvider.Setup(x => x.GetCandidate(It.IsAny <Guid>())).Returns(candidate);

            var response = Mediator.Index(Guid.NewGuid(), ApprenticeshipSearchMode.Keyword, true);

            response.AssertCode(ApprenticeshipSearchMediatorCodes.Index.Ok, true);
            response.ViewModel.Location.Should().Be("CANDIDATE POSTCODE");

            UserDataProvider.Verify(x => x.Push(UserDataItemNames.LastSearchedLocation, "CANDIDATE POSTCODE"),
                                    Times.Once);
            CandidateServiceProvider.Verify(x => x.GetCandidate(It.IsAny <Guid>()), Times.Once);
        }