From 10eb28d91818d89f596411f028595858d404af8d Mon Sep 17 00:00:00 2001 From: alexandre-spieser Date: Sun, 19 Nov 2017 19:10:22 +0000 Subject: [PATCH] added SqlUserStoreMethodsThrowWhenDisposedTest back --- .../UserStoreTest.cs | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/test/AspNetCore.Identity.MongoDbCore.IntegrationTests/AspNetCore.Identity.MongoDbCore.Test/UserStoreTest.cs b/test/AspNetCore.Identity.MongoDbCore.IntegrationTests/AspNetCore.Identity.MongoDbCore.Test/UserStoreTest.cs index 65077ee..e052800 100644 --- a/test/AspNetCore.Identity.MongoDbCore.IntegrationTests/AspNetCore.Identity.MongoDbCore.Test/UserStoreTest.cs +++ b/test/AspNetCore.Identity.MongoDbCore.IntegrationTests/AspNetCore.Identity.MongoDbCore.Test/UserStoreTest.cs @@ -16,9 +16,9 @@ namespace AspNetCore.Identity.MongoDbCore.Test { public class UserStoreTest : IdentitySpecificationTestBase, IClassFixture> { - private readonly MongoDatabaseFixture _fixture; + private readonly MongoDatabaseFixture _fixture; - public UserStoreTest(MongoDatabaseFixture fixture) + public UserStoreTest(MongoDatabaseFixture fixture) { _fixture = fixture; } @@ -48,6 +48,39 @@ namespace AspNetCore.Identity.MongoDbCore.Test services.AddSingleton>(new MongoRoleStore(Container.MongoRepository.Context)); } + [Fact] + public async Task SqlUserStoreMethodsThrowWhenDisposedTest() + { + var store = new MongoUserStore(Container.MongoRepository.Context); + store.Dispose(); + await Assert.ThrowsAsync(async () => await store.AddClaimsAsync(null, null)); + await Assert.ThrowsAsync(async () => await store.AddLoginAsync(null, null)); + await Assert.ThrowsAsync(async () => await store.AddToRoleAsync(null, null)); + await Assert.ThrowsAsync(async () => await store.GetClaimsAsync(null)); + await Assert.ThrowsAsync(async () => await store.GetLoginsAsync(null)); + await Assert.ThrowsAsync(async () => await store.GetRolesAsync(null)); + await Assert.ThrowsAsync(async () => await store.IsInRoleAsync(null, null)); + await Assert.ThrowsAsync(async () => await store.RemoveClaimsAsync(null, null)); + await Assert.ThrowsAsync(async () => await store.RemoveLoginAsync(null, null, null)); + await Assert.ThrowsAsync( + async () => await store.RemoveFromRoleAsync(null, null)); + await Assert.ThrowsAsync(async () => await store.RemoveClaimsAsync(null, null)); + await Assert.ThrowsAsync(async () => await store.ReplaceClaimAsync(null, null, null)); + await Assert.ThrowsAsync(async () => await store.FindByLoginAsync(null, null)); + await Assert.ThrowsAsync(async () => await store.FindByIdAsync(null)); + await Assert.ThrowsAsync(async () => await store.FindByNameAsync(null)); + await Assert.ThrowsAsync(async () => await store.CreateAsync(null)); + await Assert.ThrowsAsync(async () => await store.UpdateAsync(null)); + await Assert.ThrowsAsync(async () => await store.DeleteAsync(null)); + await Assert.ThrowsAsync( + async () => await store.SetEmailConfirmedAsync(null, true)); + await Assert.ThrowsAsync(async () => await store.GetEmailConfirmedAsync(null)); + await Assert.ThrowsAsync( + async () => await store.SetPhoneNumberConfirmedAsync(null, true)); + await Assert.ThrowsAsync( + async () => await store.GetPhoneNumberConfirmedAsync(null)); + } + [Fact] public async Task UserStorePublicNullCheckTest() {