private static Uri ExecuteAssetDeleteRequest( AssetDeleteOptionsRequestAdapter adapter) { Uri uri = null; var context = new DataServiceContext(new Uri("http://127.0.0.1/" + Guid.NewGuid().ToString())); bool sendingRequestCalled = false; context.SendingRequest2 += delegate(object o, SendingRequest2EventArgs args) { sendingRequestCalled = true; uri = args.RequestMessage.Url; }; try { AssetData asset = new AssetData() {Id = Guid.NewGuid().ToString()}; context.AttachTo("Assets", asset); context.DeleteObject(asset); adapter.Adapt(context); context.SaveChanges(); } catch (DataServiceRequestException ex) { Debug.WriteLine(ex.Message); } Assert.IsTrue(sendingRequestCalled); return uri; }
public void CheckParameterSetToTrue() { AssetDeleteOptionsRequestAdapter adapter = new AssetDeleteOptionsRequestAdapter(true); Uri uri = ExecuteAssetDeleteRequest(adapter); Assert.IsNotNull(uri); Assert.IsTrue(uri.Query.Contains("keepcontainer=true")); }