public async Task CreateAsync_should_add_entity_id_to_parent()
        {
            using var store = new RavenDbTestDriverWrapper().GetDocumentStore();

            using var s1 = store.OpenAsyncSession();
            await s1.StoreAsync(new Entity.RelyingParty
            {
                Id = "test",
            }, $"{nameof(Entity.RelyingParty).ToLowerInvariant()}/test");

            await s1.SaveChangesAsync();

            var loggerMock = new Mock <ILogger <AdminStore <Entity.RelyingPartyClaimMapping> > >();

            using var session = store.OpenAsyncSession();

            var sut = CreateSut(session, loggerMock.Object);

            var entity = new Entity.RelyingPartyClaimMapping
            {
                Id             = Guid.NewGuid().ToString(),
                RelyingPartyId = "test"
            };

            await sut.CreateAsync(entity);

            using var s2 = store.OpenAsyncSession();
            var parent = await s2.LoadAsync <Entity.RelyingParty>($"{nameof(Entity.RelyingParty).ToLowerInvariant()}/test");

            var collection = GetCollection(parent);

            Assert.Contains(collection, i => i.Id == $"{typeof(Entity.RelyingPartyClaimMapping).Name.ToLowerInvariant()}/{entity.Id}");
        }
        public async Task DeleteAsync_should_not_throw_when_parent_not_exists()
        {
            using var store = new RavenDbTestDriverWrapper().GetDocumentStore();

            var entity = new Entity.RelyingPartyClaimMapping
            {
                Id             = Guid.NewGuid().ToString(),
                RelyingPartyId = "test"
            };

            using var s1 = store.OpenAsyncSession();
            await s1.StoreAsync(entity, $"{typeof(Entity.RelyingPartyClaimMapping).Name.ToLowerInvariant()}/{entity.Id}");

            await s1.SaveChangesAsync();

            var loggerMock = new Mock <ILogger <AdminStore <Entity.RelyingPartyClaimMapping> > >();

            using var session = store.OpenAsyncSession();

            var sut = CreateSut(session, loggerMock.Object);


            await sut.DeleteAsync(entity.Id);

            using var s2 = store.OpenAsyncSession();
            Assert.Null(await s2.LoadAsync <Entity.RelyingPartyClaimMapping>($"{typeof(Entity.RelyingPartyClaimMapping).Name.ToLowerInvariant()}/{entity.Id}"));
        }
        public async Task CreateAsync_should_throw_when_parent_not_exists()
        {
            using var store = new RavenDbTestDriverWrapper().GetDocumentStore();

            var loggerMock = new Mock <ILogger <AdminStore <Entity.RelyingPartyClaimMapping> > >();

            using var session = store.OpenAsyncSession();

            var sut = CreateSut(session, loggerMock.Object);

            var entity = new Entity.RelyingPartyClaimMapping
            {
                Id             = Guid.NewGuid().ToString(),
                RelyingPartyId = "test"
            };

            await Assert.ThrowsAsync <InvalidOperationException>(() => sut.CreateAsync(entity));
        }