public TenantServiceShould() { var fixture = TestFixture.Create(); testUser = fixture.Create <PlannerAppUser>(); mockHttpContext = MockHttpContext.CreateAuthenticatedHttpContext(); var httpContextMock = new Mock <IHttpContextAccessor>(); httpContextMock.Setup(m => m.HttpContext) .Returns(mockHttpContext); userManagerWrapperMock = new Mock <IUserManagerWrapper>(); userManagerWrapperMock.Setup(m => m.FindByNameAsync(It.IsAny <string>())).ReturnsAsync(testUser); sut = new TenantService(httpContextMock.Object, userManagerWrapperMock.Object); }