c# - Testing the Patch odata webapi method -


I need to test the following patch method in my audacity controller from my test project.

  [valid model] [accept works ("patch", "merge")] public ASICNC work & lt; IHttpActionResult & gt; Patch ([FromODataUri] int key, delta and lt; user & gt; patch) {var user = waiting db.Users.FindAsync (key); If (user == tap) {return NotFound (); } Patch. Patch (user); Verification of (user); If (ModelState.IsValid) {Change BadRequest (ModelState); } Try {Db.Entry (user). Property (P => P. User Type) .IsModified = false; Wait db.SaveChangesAsync (); } Hold (DbUpdateConcurrencyException) {if (! UserExists (key)) {return NotFound (); } throw; } Refund Update (User); }   

The code in the test project is as follows. Can anyone tell me how to give value to delta parameters? Currently I'm getting compilation errors on Line Controller. Patch (1, user) .;

  [TestMethod] Public Zero TestPatch () {// Organize = New User Controller (); Var user = new user (); User.id = 1; User.Lastname = "Johanson"; // Act Controller Patches (1, & lt; system. Web.Dodata.Delta & gt; User); // Asset}    

  var delta = new delta & lt; Users & gt; (Typef (user)); Delta TrySetPropertyValue ("Id", 1); Delta TrySetPropertyValue ("Last name", "Johansson");   

I do not know that there are some helpful ways to make it easy

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -