public ActionResult Index(Person per) { return View(); }
public int SavePerson(Person person) { db.People.Add(person); return db.SaveChanges(); }
public ActionResult Results(Person model) { return View("Results", model); }
public void Put_Person_Throws_When_Update_fails() { // Arrange var person = new Web.Models.Person {Id = ObjectId.GenerateNewId().ToString()}; var service = new Mock<IPersonService>(); service.Setup(s => s.Update(It.IsAny<Library.Entity.Person>())).Throws<Exception>(); var controller = new PersonController(service.Object); // Act var result = controller.Put(person.Id, person) as ExceptionResult; // Assert Assert.NotNull(result); }
public void Put_Person_Runs_Service_Update() { // Arrange var person = new Web.Models.Person { FirstName = "John", LastName = "McClung", MiddleName = "Paul", Notes = "Crazy as can be", Id = ObjectId.GenerateNewId().ToString() }; var service = Mock.Of<IPersonService>(); var controller = new PersonController(service); // Act controller.Put(person.Id, person); // Assert Mock.Get(service).Verify(s => s.Update(It.Is<Library.Entity.Person> (e => e.Id.ToString() == person.Id)), Times.Once); }
public int SavePerson(Person person) { return repo.SavePerson(person); }