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); CacheKey = CacheKeyHelper.GetCacheKey(httpContext.User.GetUserId(), CacheConstants.ReregisterCacheKey); ViewModel = new ReregisterViewModel(); MockResult = new ReregistrationResponse(); }
public async override Task When() { ActualResult = await Loader.ReregistrationAsync(AoUkprn, ViewModel); }