public ProviderProfileInformationController( IProfileTotalsService profileTotalsService, IProfileHistoryService profileHistoryService) { Guard.ArgumentNotNull(profileTotalsService, nameof(profileTotalsService)); Guard.ArgumentNotNull(profileHistoryService, nameof(profileHistoryService)); _profileTotalsService = profileTotalsService; _profileHistoryService = profileHistoryService; }
public void SetUp() { _profileTotalsService = Substitute.For <IProfileTotalsService>(); _profileHistoryService = Substitute.For <IProfileHistoryService>(); _controller = new ProviderProfileInformationController( _profileTotalsService, _profileHistoryService); _fundingStreamId = NewRandomString(); _fundPeriodId = NewRandomString(); _providerId = NewRandomString(); _correlationId = NewRandomString(); _userId = NewRandomString(); _userName = NewRandomString(); HttpContext context = Substitute.For <HttpContext>(); HttpRequest request = Substitute.For <HttpRequest>(); ClaimsPrincipal claimsPrincipal = new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(ClaimTypes.Sid, _userId), new Claim(ClaimTypes.Name, _userName) })); context.Request.Returns(request); request.HttpContext.Returns(context); context.User.Returns(claimsPrincipal); _controller.ControllerContext = new ControllerContext { HttpContext = context }; request.Headers.Returns(new HeaderDictionary(new Dictionary <string, StringValues> { { "sfa-correlationId", new StringValues(_correlationId) } })); }