public override void Given() { cacheResult = new ChangeProviderCoreNotSupportedViewModel { ProviderDisplayName = "Test (12345678)" }; CacheService.GetAndRemoveAsync <ChangeProviderCoreNotSupportedViewModel>(CacheKey).Returns(cacheResult); mockresult = new ChangeCoreQuestionViewModel { ProfileId = 1, CoreDisplayName = "Test core (987654321)" }; RegistrationLoader.GetRegistrationChangeCoreQuestionDetailsAsync(AoUkprn, ProfileId).Returns(mockresult); }
public override void Setup() { HttpContextAccessor = Substitute.For <IHttpContextAccessor>(); RegistrationLoader = Substitute.For <IRegistrationLoader>(); CacheService = Substitute.For <ICacheService>(); Logger = Substitute.For <ILogger <ManageRegistrationController> >(); Controller = new ManageRegistrationController(RegistrationLoader, CacheService, Logger); ProfileId = 1; AoUkprn = 1234567890; var httpContext = new ClaimsIdentityBuilder <ManageRegistrationController>(Controller) .Add(CustomClaimTypes.Ukprn, AoUkprn.ToString()) .Add(CustomClaimTypes.UserId, Guid.NewGuid().ToString()) .Build() .HttpContext; HttpContextAccessor.HttpContext.Returns(httpContext); ViewModel = new ChangeCoreQuestionViewModel(); MockResult = new ProviderChangeResponse(); CacheKey = string.Concat(CacheKeyHelper.GetCacheKey(httpContext.User.GetUserId(), CacheConstants.RegistrationCacheKey), Common.Helpers.Constants.ChangeRegistrationProviderCoreNotSupportedViewModel); }
public override void Given() { ViewModel = new ChangeCoreQuestionViewModel(); Controller.ModelState.AddModelError("CanChangeCore", ChangeCoreQuestionContent.Select_ChangeCoreQuestion_Validation_Message); }
public async override Task When() { ActualResult = await Loader.GetRegistrationChangeCoreQuestionDetailsAsync(AoUkprn, ProfileId); }