public ActionResult Create(SessionTopicViewModel sessionTopicViewModel) { if (ModelState.IsValid) { var result = Mapper.Map <SessionTopicViewModel, SessionTopic>(sessionTopicViewModel); _SessionTopicService.Create(result); return(RedirectToAction("Index")); } return(View(sessionTopicViewModel)); }
public void CanAddSessionTopic() { //Arrange int id = 1; SessionTopic emp = new SessionTopic() { Name = "UK" }; _mockRepository.Setup(m => m.Add(emp)).Returns((SessionTopic e) => { e.Id = id; return(e); }); //Act _service.Create(emp); //Assert Assert.AreEqual(id, emp.Id); _mockUnitWork.Verify(m => m.Commit(), Times.Once); }