public void Test_Dynamic_Module_List() { // Arrange var fakeRepo = new FakeModuleRepository(); var fakeMembership = new FakeModuleMembership(); DynamicModuleController controller = new DynamicModuleController(fakeRepo, fakeMembership); // Act var fakeModule = fakeRepo.GetModuleById(0); var result = controller.List(fakeModule); // Assert Assert.IsInstanceOfType(result, typeof(ViewResult)); var viewResult = result as ViewResult; var model = viewResult.ViewData.Model; Assert.IsNotNull(model); Assert.IsInstanceOfType(model, typeof(IEnumerable <DynamicModuleViewModel>)); var viewModel = model as IEnumerable <DynamicModuleViewModel>; Assert.AreEqual(fakeModule.ModuleName, viewResult.ViewData["ModuleName"]); Assert.AreEqual(fakeModule.DisplayName, viewResult.ViewData["DisplayName"]); }
public void Test_Dynamic_Module_List() { // Arrange var fakeRepo = new FakeModuleRepository(); var fakeMembership = new FakeModuleMembership(); DynamicModuleController controller = new DynamicModuleController(fakeRepo, fakeMembership); // Act var fakeModule = fakeRepo.GetModuleById(0); var result = controller.List(fakeModule); // Assert Assert.IsInstanceOfType(result, typeof(ViewResult)); var viewResult = result as ViewResult; var model = viewResult.ViewData.Model; Assert.IsNotNull(model); Assert.IsInstanceOfType(model, typeof(IEnumerable<DynamicModuleViewModel>)); var viewModel = model as IEnumerable<DynamicModuleViewModel>; Assert.AreEqual(fakeModule.ModuleName, viewResult.ViewData["ModuleName"]); Assert.AreEqual(fakeModule.DisplayName, viewResult.ViewData["DisplayName"]); }