// DELETE: api/IDProof/5 public IHttpActionResult Delete(int id) { IDProof result = IDProofList.Where(p => p.ID == id).FirstOrDefault(); var resultflag = IDProofList.Remove(result); return(Ok(resultflag)); }
// PUT: api/IDProof/5 public IHttpActionResult Put(int id, IDProof value) { IDProof result = IDProofList.Where(p => p.ID == id).FirstOrDefault(); result.Type = value.Type; result.Value = value.Value; result.Status = value.Status; result.Comments = value.Comments; return(Ok(result)); }
public void PostIDProof() { // Arrange IDProofController controller = new IDProofController(); IDProof IDProofObj = new IDProof { Value = "123456", Comments = "Good Work", }; var actResult = controller.Post(IDProofObj); // Act var result = actResult as OkNegotiatedContentResult <IDProof>; // Assert Assert.IsNotNull(result); Assert.IsTrue(result.Content.ID > 0); }
public void PutIDProof() { // Arrange IDProofController controller = new IDProofController(); IDProof IDProofObj = new IDProof { Value = "Put request sucessfull", Comments = "Good Work", ID = 1 }; var actResult = controller.Put(1, IDProofObj); // Act var result = actResult as OkNegotiatedContentResult <IDProof>; // Assert Assert.IsNotNull(result); Assert.IsTrue(result.Content.Value.Equals("Put request sucessfull")); }
// POST: api/IDProof public IHttpActionResult Post(IDProof value) { IDProofList.Add(value); value.ID = IDProofList.Count; return(Ok(value)); }