private static async Task RunTestWhichShouldNotSucceedAsync(AuthorizationHandlerContext context) { var handler = new TestHandler(); await handler.HandleAsync(context); AssertNoSuccessOrFailure(context); }
public async Task HandleAsyncShouldSucceed() { var handler = new TestHandler(); var context = CreateContextWhichShouldSucceed(); await handler.HandleAsync(context); Assert.IsTrue(context.HasSucceeded); }
public async Task HandleAsyncShouldNotSucceed() { var handler = new TestHandler(); var context = CreateContext(new AssertionRequirement(x => true)); await handler.HandleAsync(context); Assert.IsFalse(context.HasSucceeded); Assert.IsFalse(context.HasFailed); }
public async Task HandleAsyncShouldThrowWhenContextIsNull() { var handler = new TestHandler(); await handler.HandleAsync(null); }