public async Task overwrite_behavior_async()
        {
            Guid originalVerion = Guid.Empty;
            var  doc            = new AttVersionedDoc();

            using (var session = theStore.OpenSession())
            {
                session.Store(doc);

                session.VersionFor(doc).ShouldBeNull();

                await session.SaveChangesAsync();

                originalVerion = doc.Version;
            }

            IDocumentSession session1 = null;
            IDocumentSession session2 = null;

            try
            {
                session1 = theStore.OpenSession();
                session2 = theStore.OpenSession(new SessionOptions
                {
                    ConcurrencyChecks = ConcurrencyChecks.Disabled
                });

                var doc1 = await session1.LoadAsync <AttVersionedDoc>(doc.Id);

                doc1.Version.ShouldBe(originalVerion);
                session1.VersionFor(doc1).ShouldBe(originalVerion);
                session1.Store(doc1);

                var doc2 = await session2.LoadAsync <AttVersionedDoc>(doc.Id);

                session2.Store(doc2);

                // save via session1
                await session1.SaveChangesAsync();

                doc1.Version.ShouldNotBe(originalVerion);

                // overwrite successfully w/ session2
                await session2.SaveChangesAsync();

                doc2.Version.ShouldNotBe(originalVerion);
                doc2.Version.ShouldNotBe(doc1.Version);
            }
            finally
            {
                session1?.Dispose();
                session2?.Dispose();
            }
        }
        public async Task save_initial_version_of_the_doc_and_see_the_initial_version_assigned_async()
        {
            var doc = new AttVersionedDoc();

            using (var session = theStore.OpenSession())
            {
                session.Store(doc);

                session.VersionFor(doc).ShouldBeNull();

                await session.SaveChangesAsync();

                session.VersionFor(doc).ShouldNotBeNull();
                doc.Version.ShouldNotBe(Guid.Empty);
                doc.Version.ShouldBe(session.VersionFor(doc).Value);
            }
        }
        public void versions_are_assigned_during_bulk_inserts_as_field()
        {
            var docs = new AttVersionedDoc[100];

            for (var i = 0; i < docs.Length; i++)
            {
                docs[i] = new AttVersionedDoc();
            }

            theStore.BulkInsert(docs);

            foreach (var doc in docs)
            {
                doc.Version.ShouldNotBe(Guid.Empty);
            }

            using (var session = theStore.OpenSession())
            {
                session.Query <AttVersionedDoc>().Count(d => d.Version != Guid.Empty).ShouldBe(100);
            }
        }