Esempio n. 1
0
        public async Task last_modified_is_updated_on_the_document_when_it_is_saved()
        {
            var original = Guid.NewGuid();
            var doc      = new MetadataTarget {
                Version = original
            };

            theSession.Store(doc);
            await theSession.SaveChangesAsync();
        }
Esempio n. 2
0
        public async Task can_insert_and_load()
        {
            var doc = new MetadataTarget();

            theSession.Insert(doc);
            await theSession.SaveChangesAsync();

            using var session = theStore.LightweightSession();
            var doc2 = await session.LoadAsync <MetadataTarget>(doc.Id);

            doc2.ShouldNotBeNull();
        }
Esempio n. 3
0
        public async Task version_is_available_on_query_only()
        {
            var doc = new MetadataTarget();

            theSession.Store(doc);
            await theSession.SaveChangesAsync();

            using var query = theStore.QuerySession();

            var doc2 = await query.LoadAsync <MetadataTarget>(doc.Id);

            doc2.Version.ShouldNotBe(Guid.Empty);
        }
Esempio n. 4
0
        public async Task can_bulk_insert_async()
        {
            var docs = new MetadataTarget[]
            {
                new MetadataTarget(),
                new MetadataTarget(),
                new MetadataTarget(),
                new MetadataTarget(),
                new MetadataTarget(),
                new MetadataTarget()
            };

            await theStore.BulkInsertAsync(docs);
        }
Esempio n. 5
0
        public void can_bulk_insert()
        {
            var docs = new MetadataTarget[]
            {
                new MetadataTarget(),
                new MetadataTarget(),
                new MetadataTarget(),
                new MetadataTarget(),
                new MetadataTarget(),
                new MetadataTarget()
            };

            theStore.BulkInsert(docs);
        }
Esempio n. 6
0
        public async Task can_save_update_and_load_queryonly()
        {
            var doc = new MetadataTarget();

            theSession.Store(doc);
            await theSession.SaveChangesAsync();

            doc.Name = "different";
            theSession.Update(doc);
            await theSession.SaveChangesAsync();

            using var session = theStore.QuerySession();
            var doc2 = await session.LoadAsync <MetadataTarget>(doc.Id);

            doc2.Name.ShouldBe("different");
        }
Esempio n. 7
0
        public async Task save_and_load_and_see_header_values()
        {
            theSession.SetHeader("name", "Jeremy");
            theSession.SetHeader("hour", 5);

            var doc = new MetadataTarget();

            theSession.Store(doc);
            await theSession.SaveChangesAsync();

            using var session = theStore.QuerySession();

            var doc2 = await session.LoadAsync <MetadataTarget>(doc.Id);

            doc2.Headers["name"].ShouldBe("Jeremy");
            doc2.Headers["hour"].ShouldBe(5);
        }
Esempio n. 8
0
        public async Task can_save_update_and_load_with_dirty_session()
        {
            var doc = new MetadataTarget();

            using var session = theStore.DirtyTrackedSession();
            session.Store(doc);
            await session.SaveChangesAsync();

            doc.Name = "different";
            theSession.Update(doc);
            await theSession.SaveChangesAsync();

            using var session2 = theStore.DirtyTrackedSession();
            var doc2 = await session2.LoadAsync <MetadataTarget>(doc.Id);

            doc2.Name.ShouldBe("different");
        }
Esempio n. 9
0
        public async Task save_and_load_metadata_last_modified_by()
        {
            var doc = new MetadataTarget();

            theSession.Store(doc);
            await theSession.SaveChangesAsync();

            var metadata = await theSession.MetadataForAsync(doc);

            metadata.LastModifiedBy.ShouldBe(theSession.LastModifiedBy);

            using (var session2 = theStore.QuerySession())
            {
                var doc2 = await session2.LoadAsync <MetadataTarget>(doc.Id);

                doc2.LastModifiedBy.ShouldBe(theSession.LastModifiedBy);
            }
        }
Esempio n. 10
0
        public async Task save_and_load_metadata_correlation()
        {
            var doc = new MetadataTarget();

            theSession.Store(doc);
            await theSession.SaveChangesAsync();

            var metadata = await theSession.MetadataForAsync(doc);

            metadata.CorrelationId.ShouldBe(theSession.CorrelationId);

            using (var session2 = theStore.QuerySession())
            {
                var doc2 = await session2.LoadAsync <MetadataTarget>(doc.Id);

                doc2.CorrelationId.ShouldBe(theSession.CorrelationId);
            }
        }