public void SpeciesValidationOnCreate() { //Checking property validation for a new Treatment object, should pass when the properties aren't empty CheckPropertyValidation cpv = new CheckPropertyValidation(); var species = new Models.Species { Name = "Hund", }; var errorcount = cpv.myValidation(species).Count(); Assert.AreEqual(0, errorcount); }
public IActionResult OnGet(int?id) { SpeciesObj = new Models.Species(); if (id != null) { SpeciesObj = _unitOfWork.Species.GetFirstOrDefault(u => u.Id == id); if (SpeciesObj == null) { return(NotFound()); } } return(Page()); }