public async Task ShouldAllowAdministrator() { await RunAsAdministratorAsync(); var command = new PurgeTodoListsCommand(); FluentActions.Invoking(() => SendAsync(command)) .Should().NotThrow <ForbiddenAccessException>(); }
public void ShouldDenyAnonymousUser() { var command = new PurgeTodoListsCommand(); command.GetType().Should().BeDecoratedWith <AuthorizeAttribute>(); FluentActions.Invoking(() => SendAsync(command)).Should().Throw <UnauthorizedAccessException>(); }