public IEnumerator SetGetDocumentNested() { yield return(T().YieldWait()); async Task T() { var t1 = TestDocument2.SetAsync <TestDataAB>(new TestDataAB { a = 1, b = "x" }); var t2 = TestDocument21.SetAsync <TestDataAB>(new TestDataAB { a = 2, b = "y" }); var t3 = TestDocument22.SetAsync <TestDataAB>(new TestDataAB { a = 3, b = "z" }); await Task.WhenAll(new Task[] { t1, t2, t3 }); var i1 = (await TestDocument2.GetSnapshotAsync()).ConvertTo <TestDataAB>(); var i2 = (await TestDocument21.GetSnapshotAsync()).ConvertTo <TestDataAB>(); var i3 = (await TestDocument22.GetSnapshotAsync()).ConvertTo <TestDataAB>(); Assert.That(i1.a, Is.EqualTo(1)); Assert.That(i1.b, Is.EqualTo("x")); Assert.That(i2.a, Is.EqualTo(2)); Assert.That(i2.b, Is.EqualTo("y")); Assert.That(i3.a, Is.EqualTo(3)); Assert.That(i3.b, Is.EqualTo("z")); } }
private async Task SetupForQuery() { //Scrambled write order await TestDocument3.SetAsync <TestDataABC>(new TestDataABC { a = 3, b = "z", c = 33.333 }); await TestDocument1.SetAsync <TestDataABC>(new TestDataABC { a = 1, b = "x", c = 11.111 }); await TestDocument2.SetAsync <TestDataABC>(new TestDataABC { a = 2, b = "y", c = 22.222 }); await TestDocument22.SetAsync <TestDataABC>(new TestDataABC { a = 22, b = "yo", c = 222.222 }); await TestDocument21.SetAsync <TestDataABC>(new TestDataABC { a = 21, b = "hey", c = 111.111 }); }