public void SetUp() { _mockCertificateApiClient = new Mock <ICertificateApiClient>(); _mockContextAccessor = new Mock <IHttpContextAccessor>(); _mockSessionService = new Mock <ISessionService>(); _mockContextAccessor.Setup(s => s.HttpContext.User.FindFirst("http://schemas.portal.com/ukprn")).Returns(new Claim("", Ukprn.ToString())); _mockContextAccessor.Setup(s => s.HttpContext.User.FindFirst("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn")).Returns(new Claim("", Username)); _mockContextAccessor.Setup(s => s.HttpContext.User.FindFirst("http://schemas.portal.com/epaoid")).Returns(new Claim("", EpaoId)); _mockContextAccessor.Setup(s => s.HttpContext.Request.Query).Returns(Mock.Of <IQueryCollection>()); var certData = new CertificateData(); var certDataString = JsonConvert.SerializeObject(certData); _mockCertificateApiClient.Setup(s => s.GetCertificate(It.IsAny <Guid>(), false)).ReturnsAsync( new Certificate { Id = CertificateId, CertificateData = certDataString }); _certificateOptionController = new CertificateOptionController(Mock.Of <ILogger <CertificateController> >(), _mockContextAccessor.Object, _mockCertificateApiClient.Object, _mockSessionService.Object); }
public void Arrange() { var certificateGradeController = new CertificateOptionController(MockedLogger.Object, MockHttpContextAccessor.Object, ApiClient); _result = certificateGradeController.Option(Certificate.Id).GetAwaiter().GetResult(); }