public async Task RoleStorePublicNullCheckTest() { Assert.Throws <ArgumentNullException>("db", () => new FirestoreRoleStore <IdentityRole>(null)); var store = new FirestoreRoleStore <IdentityRole>(new Mock <IFirestoreDbContext>().Object); await Assert.ThrowsAsync <ArgumentNullException>("role", async() => await store.GetRoleIdAsync(null)); await Assert.ThrowsAsync <ArgumentNullException>("role", async() => await store.GetRoleNameAsync(null)); await Assert.ThrowsAsync <ArgumentNullException>("role", async() => await store.SetRoleNameAsync(null, null)); await Assert.ThrowsAsync <ArgumentNullException>("role", async() => await store.CreateAsync(null)); await Assert.ThrowsAsync <ArgumentNullException>("role", async() => await store.UpdateAsync(null)); await Assert.ThrowsAsync <ArgumentNullException>("role", async() => await store.DeleteAsync(null)); }
public async Task RoleStoreMethodsThrowWhenDisposedTest() { var store = new FirestoreRoleStore <IdentityRole>(new Mock <IFirestoreDbContext>().Object); store.Dispose(); await Assert.ThrowsAsync <ObjectDisposedException>(async() => await store.FindByIdAsync(null)); await Assert.ThrowsAsync <ObjectDisposedException>(async() => await store.FindByNameAsync(null)); await Assert.ThrowsAsync <ObjectDisposedException>(async() => await store.GetRoleIdAsync(null)); await Assert.ThrowsAsync <ObjectDisposedException>(async() => await store.GetRoleNameAsync(null)); await Assert.ThrowsAsync <ObjectDisposedException>(async() => await store.SetRoleNameAsync(null, null)); await Assert.ThrowsAsync <ObjectDisposedException>(async() => await store.CreateAsync(null)); await Assert.ThrowsAsync <ObjectDisposedException>(async() => await store.UpdateAsync(null)); await Assert.ThrowsAsync <ObjectDisposedException>(async() => await store.DeleteAsync(null)); }