public async Task Create() { using var httpTest = new HttpTest(); httpTest.RespondWithJson(new { Id = "xxx", Ok = true, Rev = "xxx" }); var r = new Rebel { Name = "Luke" }; var newR = await _rebels.AddAsync(r); httpTest .ShouldHaveCalled("http://localhost/rebels") .WithVerb(HttpMethod.Post); }
public async Task ChangesFeed() { _ = await _rebels.AddAsync(new Rebel { Name = "Luke_1", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_2", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_3", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_4", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_5", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_6", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_7", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_8", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_9", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_10", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_11", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_12", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_13", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_14", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_15", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_16", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_17", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_18", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_19", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_20", Age = 19 }); var lineCount = 0; var tokenSource = new CancellationTokenSource(); await foreach (var l in _rebels.GetContinuousChangesAsync(null, null, tokenSource.Token)) { lineCount++; if (lineCount == 20) { _ = await _rebels.AddAsync(new Rebel { Name = "Luke_11", Age = 19 }); _ = await _rebels.AddAsync(new Rebel { Name = "Luke_12", Age = 19 }); } if (lineCount == 22) { tokenSource.Cancel(); } } }