コード例 #1
0
        public async Task ValidateHandleAsync_NoReportees_Failed()
        {
            this.userService
            .Setup(x => x.GetReporteesAsync(It.IsAny <string>()))
            .Returns(Task.FromResult(Enumerable.Empty <User>()));

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

            var authorizationContext = FakeHttpContext.GetFakeAuthorizationHandlerContextForMustHaveReporteesPolicy();

            await this.mustHaveReporteesPolicyHandler.HandleAsync(authorizationContext);

            Assert.IsFalse(authorizationContext.HasSucceeded);
        }