public async Task ValidateHandleAsync_UserIsNotPartOfProjects_Failed() { var memberRepository = new Mock <IMemberRepository>(); memberRepository .Setup(x => x.FindAsync(It.IsAny <Expression <Func <Member, bool> > >())) .Returns(Task.FromResult(Enumerable.Empty <Member>())); this.repositoryAccessors.Setup(x => x.MemberRepository).Returns(memberRepository.Object); this.botOptions.Setup(x => x.Value).Returns(new BotSettings { UserPartOfProjectsCacheDurationInHour = 1 }); var fakeAuthorizationContext = FakeHttpContext.GetFakeAuthorizationHandlerContext(); await this.mustBeProjectMemberPolicyHandler.HandleAsync(fakeAuthorizationContext); Assert.IsFalse(fakeAuthorizationContext.HasSucceeded); }