I am a beginner in ASP.NET MVC. I am trying to unit test a create method that has unit of work implemented for a school project. I read many tutorials about unit testing but didn't find anything similar to my task, except another unit testing question on a create method on "stackOverflow" but I didn't know how to use that to resolve my task. Can you please guide me to the right direction. Thanks
This is a snippet of the Create method:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "Id,Code,Description")] LocationCode locationCode)
{
if (ModelState.IsValid)
{
uow.LocationCodeRepository.Insert(locationCode);
return RedirectToAction("Index");
}
return View(locationCode);
}
Aucun commentaire:
Enregistrer un commentaire