public void TestObjectDelete() { var host = "localhost:8080"; var key = "KxDgvEKzgSBPPfuVfw67oPQBSjidEiqTHURKSDL1R7yGaGYAeYnr".LoadWif(); var cid = ContainerID.FromBase58String("Bun3sfMBpnjKc3Tx7SdwrMxyNi8ha8JT3dhuFGvYBRTz"); var oid = ObjectID.FromBase58String("CnBNgUmXiA5KJeGvMDgUEGiKrbZctjwxT5v3sBYjnmf1"); var address = new Address(cid, oid); var client = new Client.Client(key, host); var source1 = new CancellationTokenSource(); source1.CancelAfter(TimeSpan.FromMinutes(1)); var session = client.CreateSession(source1.Token, ulong.MaxValue); source1.Cancel(); var source2 = new CancellationTokenSource(); source2.CancelAfter(TimeSpan.FromMinutes(1)); var o = client.DeleteObject(source2.Token, new DeleteObjectParams { Address = address }, new CallOptions { Ttl = 2, Session = session }); Assert.IsTrue(o); }
public void TestObjectDelete() { using var client = new Client.Client(key, host); using var source1 = new CancellationTokenSource(); source1.CancelAfter(TimeSpan.FromMinutes(1)); var session = client.CreateSession(ulong.MaxValue, context: source1.Token).Result; source1.Cancel(); using var source2 = new CancellationTokenSource(); source2.CancelAfter(TimeSpan.FromMinutes(1)); var o = client.DeleteObject(Address, new CallOptions { Ttl = 2, Session = session }, source2.Token).Result; Assert.IsNotNull(o); Console.WriteLine(o.ObjectId.String()); }