Exemple #1
0
        public async Task ValidateHandleAsync_InvalidReportee_Failed()
        {
            var memberRepository = new Mock <IMemberRepository>();

            this.userHelper
            .Setup(x => x.GetAllReporteesAsync(It.IsAny <Guid>()))
            .Returns(Task.FromResult(Enumerable.Empty <User>()));

            this.repositoryAccessors.Setup(x => x.MemberRepository).Returns(memberRepository.Object);
            this.botOptions.Setup(x => x.Value).Returns(new BotSettings {
                ManagerReporteesCacheDurationInHours = 1
            });

            var fakeAuthorizationContext = FakeHttpContext.GetFakeAuthorizationHandlerContextForMustBeValidReporteePolicy();

            await this.mustBeValidReporteePolicyHandler.HandleAsync(fakeAuthorizationContext);

            Assert.IsFalse(fakeAuthorizationContext.HasSucceeded);
        }