//GET /LocationTypes/Details/id public ActionResult Details(int id) { var model = new DisplayLocationTypeViewModel(); var locationType = LocationService.GetLocationType(id); if (locationType == null) { return(RedirectToAction("Index")); } var createdBy = UserService.GetUser(locationType.CreatedBy); model.PopulateFields(locationType, createdBy); return(View(model)); }
public void Details_Should_return_apropriate_data() { // Act var result = controller.Details(1) as ViewResult; // Assert DisplayLocationTypeViewModel model = (DisplayLocationTypeViewModel)result.Model; Assert.IsNotNull(result); Assert.IsNotNull(model); Assert.AreEqual(model.TypeName, "Continent"); Assert.AreEqual(model.TypeDescription, "Continent Description"); Assert.AreEqual(model.Icon, "Continent.png"); Assert.AreEqual(model.CreatedBy, "UserName1"); Assert.AreEqual(model.DefaultDisplayName, "Contitent Display"); }