Пример #1
0
        public async Task OnTurnAsync_PopulatedAllowList_AllowedTenantAsync()
        {
            // Setup
            var turnContextMock = new Mock <ITurnContext>();
            var activity        = this.TeamsActivityWithTenantId(true, "TenantId");

            turnContextMock.Setup((turnContext) => turnContext.Activity).Returns(activity);
            var  middleware       = new TeamsTenantFilteringMiddleware(new string[] { "TenantId" });
            bool isDelegateCalled = false;

            Task Next(CancellationToken cancellationToken) => Task.FromResult(isDelegateCalled = true);

            // Action
            await middleware.OnTurnAsync(turnContextMock.Object, Next).ConfigureAwait(false);

            // Verify
            Assert.IsTrue(isDelegateCalled); // This doesn't actually get called since we throw an exception.
        }
Пример #2
0
 public void Constructor_Nulls()
 {
     var middleware = new TeamsTenantFilteringMiddleware(null);
 }