/// <summary> /// Initializes a new instance of the <see cref="AuthenticationFlowTest"/> class. /// </summary> /// <param name="outputHelper">The test output helper.</param> public AuthenticationFlowTest(ITestOutputHelper outputHelper) { this.outputHelper = outputHelper; this.testDatabase = new TestDatabase(outputHelper); this.dbContext = this.testDatabase.CreateContext(); this.identityInstance = IdentityTestHelper.CreateInstance(this.testDatabase, this.outputHelper); this.usedHttpContext = new DefaultHttpContext(); this.httpConctextAccessorMock = new Mock <IHttpContextAccessor>(); this.jwtCrypoMock = new Mock <IJwtCryptoProvider>(); this.momentMock = MomentTestHelper.CreateMomentMock(); this.optionsMonitorMock = OptionsTestHelper.CreateBackendOptionsMock(); this.randomGenerator = new SecureRandomGenerator(); this.loggerFactory = LoggingTestHelper.CreateLoggerFactory(this.outputHelper); this.httpConctextAccessorMock.SetupGet(m => m.HttpContext).Returns(this.usedHttpContext); this.jwtCrypoMock.SetupGet(c => c.Algorithm).Returns(SigningAlgorithm); this.jwtCrypoMock.SetupGet(c => c.SecurityKey).Returns(SigningKey); this.authenticationFlow = new AuthenticationFlow( this.httpConctextAccessorMock.Object, this.jwtCrypoMock.Object, this.identityInstance.UserManager, this.dbContext, this.randomGenerator, this.momentMock.Object, this.optionsMonitorMock.Object, this.loggerFactory.CreateLogger <AuthenticationFlow>()); }
/// <summary> /// Initializes a new instance of the <see cref="UserProfileControllerTest"/> class. /// </summary> /// <param name="helper">test output helper.</param> public UserProfileControllerTest(ITestOutputHelper helper) { this.outputHelper = helper; this.testDatabase = new TestDatabase(this.outputHelper); this.identityInstance = IdentityTestHelper.CreateInstance(this.testDatabase, this.outputHelper); this.usedHttpContext = new DefaultHttpContext(); this.managerMock = new Mock <IUserProfileManager>(); this.controller = new UserProfileController(this.managerMock.Object, this.identityInstance.UserManager) { ControllerContext = new ControllerContext { HttpContext = this.usedHttpContext, }, }; }