public async Task TestFindByPublicKey() { var firstUser = _extendedUserStore.Users.First(); var firstKey = firstUser.ApiKeys.First(); Assert.AreEqual(firstUser, await _extendedManager.FindByPublicKeyAsync(firstKey.PublicKey)); Assert.ThrowsAsync <InvalidOperationException>(async() => await _extendedManager.FindByPublicKeyAsync("nonExisting")); }
public async Task TestNotUsingApiKeys() { var manager = new ExtendedUserManager <ExtendedUser, int>(_extendedUserStore); Assert.IsFalse(manager.SupportsUserApiKey); Assert.ThrowsAsync <NotSupportedException>(async() => await manager.FindByPublicKeyAsync("")); Assert.ThrowsAsync <NotSupportedException>(async() => await manager.CheckApiKeyAsync("")); Assert.ThrowsAsync <NotSupportedException>(async() => await manager.CheckApiKeyAsync("", "")); Assert.ThrowsAsync <NotSupportedException>(async() => await manager.GetApiKeysAsync(0)); Assert.ThrowsAsync <NotSupportedException>(async() => await manager.RemoveApiKeyAsync(null, null)); Assert.ThrowsAsync <NotSupportedException>(async() => await manager.CreateApiKeyAsync(null)); }