コード例 #1
0
        public void TestConcurrentDelete()
        {
            const int nDocs = 1000;
            var       docs  = CreateDocs(nDocs, "Create").ToList();

            docs.Count.Should().Be(nDocs);

            var delete1 = new WaitAssert();
            var ignore  = delete1.RunAssertAsync(() =>
            {
                foreach (var doc in docs)
                {
                    Db.Delete(doc);
                }
            });

            var delete2 = new WaitAssert();

            ignore = delete2.RunAssertAsync(() =>
            {
                foreach (var doc in docs)
                {
                    Db.Delete(doc);
                }
            });

            WaitAssert.WaitFor(TimeSpan.FromSeconds(60), delete1, delete2);
            Db.Count.Should().Be(0, "because all documents were deleted");
        }