public async Task Verify_missing_claim_throws() { var handler = new SimpleCommandHandler(); handler.SecurityContextManager = Substitute.For <ISecurityContextManager>(); handler.SecurityContextManager.GetCurrentClaims().ReturnsForAnyArgs(new Claim[] { new Claim("paperone", "true"), }); //invoke the handler, evereything should go ok Assert.ThrowsAsync <SecurityException>(async() => await handler.HandleAsync(new SimpleCommand()).ConfigureAwait(false)); }
public async Task Verify_basic_security_with_correct_claim() { var handler = new SimpleCommandHandler(); handler.SecurityContextManager = Substitute.For <ISecurityContextManager>(); handler.SecurityContextManager.GetCurrentClaims().ReturnsForAnyArgs(new Claim[] { new Claim("pippo", "true"), }); //invoke the handler, evereything should go ok await handler.HandleAsync(new SimpleCommand()).ConfigureAwait(false); }