public async Task Document_AddAsyncCallsClient() { var model = new Test(); var uri = new Uri("http://localhost/"); var doc = new DocumentClientService.Document <Test>(_documentClient, uri, null); await doc.AddAsync(model); _documentClient.Received().CreateDocumentAsync(uri, model); }
public async Task Document_AddAsyncCallsClient() { var model = new Test(); var uri = UriFactory.CreateDocumentCollectionUri("DB", "DOC"); var doc = new DocumentClientService.Document <Test>(_documentClient, "DB", "DOC"); await doc.AddOrUpdateAsync(model); _documentClient.Received().UpsertDocumentAsync(uri, model); }
public void Document_QueryCallsClient() { var uri = new Uri("http://localhost/"); var doc = new DocumentClientService.Document <Test>(_documentClient, uri, null); var models = new[] { new Test() }.AsQueryable(); _documentClient.CreateDocumentQuery <Test>(uri, "SEL", null).Returns(models); var result = doc.Query("SEL"); Assert.AreEqual(1, result.Count); }
public void Document_QueryCallsClient() { var uri = UriFactory.CreateDocumentCollectionUri("DB", "DOC"); var doc = new DocumentClientService.Document <Test>(_documentClient, "DB", "DOC"); var models = new[] { new Test() }.AsQueryable(); _documentClient.CreateDocumentQuery <Test>(uri, "SEL", null).Returns(models); var result = doc.Query("SEL"); Assert.AreEqual(1, result.Count); }
public async Task Document_UpdateManyCallsSP() { var model = new Test(); var models = new[] { model }; var uri = UriFactory.CreateStoredProcedureUri("DB", "DOC", "bulkUpdate"); var doc = new DocumentClientService.Document <Test>(_documentClient, "DB", "DOC"); _documentClient.ExecuteStoredProcedureAsync <int>(uri).ReturnsForAnyArgs(new StoredProcedureResponse <int>()); await doc.UpdateManyAsync(models); _documentClient.Received().ExecuteStoredProcedureAsync <int>(uri, Arg.Is(CheckModel(model))); }