public static async Task TestMergeAsync(string serverUrl) { var dataWriter1 = new MyNoSqlServerDataWriter <ReplaceEntity>(() => serverUrl, "test", false); var dataWriter2 = new MyNoSqlServerDataWriter <MergeEntity>(() => serverUrl, "test", false); var dataWriterMerged = new MyNoSqlServerDataWriter <MergedEntity>(() => serverUrl, "test", false); var replaceEntity = new ReplaceEntity { PartitionKey = "test", RowKey = "test", Value = "123" }; await dataWriter1.InsertOrReplaceAsync(replaceEntity); var operationResult = await dataWriter2.MergeAsync(replaceEntity.PartitionKey, replaceEntity.RowKey, entityToEdit => { entityToEdit.Value2 = "456"; return(true); }); Assert.AreEqual(OperationResult.Ok, operationResult); var entity = await dataWriterMerged.GetAsync(replaceEntity.PartitionKey, replaceEntity.RowKey); Assert.AreEqual("123", entity.Value); Assert.AreEqual("456", entity.Value2); Console.WriteLine("TestMergeAsync OK"); }
public static async Task ReadAssetsFees() { // var myNoSqlClient = new MyNoSqlTcpClient( GetUrl,"local"); // myNoSqlClient.Start(); // Thread.Sleep(10000); // var subs = new MyNoSqlReadRepository<AssetFeesNoSqlEntity>(myNoSqlClient, // AssetFeesNoSqlEntity.TableName); // var client = new AssetFeesClient(subs); // var fees = client.GetAssetFees("jetwallet", "BTC", OperationType.Withdrawal); // // Console.WriteLine(JsonConvert.SerializeObject(fees)); // // var entities1 = subs.Get(); // Console.WriteLine(JsonConvert.SerializeObject(entities1)); var writer = new MyNoSqlServerDataWriter <AssetFeesNoSqlEntity>(GetUrl, AssetFeesNoSqlEntity.TableName, false); var entities = await writer.GetAsync(); Console.WriteLine(JsonConvert.SerializeObject(entities)); }