public void ShouldNotAddNullPrincess() { PrincessRepository.Add(null); var princesses = _context.Princesses.ToList(); Assert.AreEqual(0, princesses.Count()); }
public ActionResult Create(Princess princess) { if (ModelState.IsValid && princess != null) { PrincessRepository.Add(princess); return(Json(new { Redirect = "Princess/" })); } ViewBag.Message = Messages.Error_Field_Check; ViewBag.Title = PersonResource.Title_CreatePrincess; return(PartialView("_Create", princess)); }
public void CanAddPrincess() { Princess expected = PersonFactory.CreatePrincess("Arthur"); PrincessRepository.Add(expected); var princesses = _context.Princesses.ToList(); Assert.AreEqual(1, princesses.Count()); Assert.AreEqual(expected, princesses.FirstOrDefault()); }