public void TestList_Xml_Normal(string format)
        {
            //Arrange
            TaskList taskList = new TaskList() { Name="TaskList"};
            TaskListController controller = CreateControllerForGet(taskList);

            // Act
            ActionResult result = controller.List(new Guid(), format);

            // Assert
            Assert.NotNull(result);
            Assert.IsInstanceOf<XmlResult>(result);

            XmlResult xmlResult = result as XmlResult;
            AssertModel(xmlResult.Data, taskList);
        }
        public void TestGetTaskList_Html_Success()
        {
            //Arrange
            TaskList taskList = new TaskList() { Name="TaskList"};
            TaskListController controller = CreateControllerForGet(taskList);

            // Act
            ActionResult result = controller.List(new Guid(), "");

            // Assert
            Assert.NotNull(result);
            Assert.IsInstanceOf<ViewResult>(result);

            ViewResult viewResult = result as ViewResult;
            AssertModel(viewResult.ViewData.Model, taskList);
        }
 public TaskListViewModel(TaskList taskList)
 {
     log.DebugFormat("Calling constructor with {0}", taskList);
     _taskList = taskList;
 }
 public TaskListViewModel()
 {
     log.Debug("Calling default constructor");
     _taskList = new TaskList();
 }
 internal void Initialize(StreamingContext context)
 {
     _taskList = new TaskList();
 }
        private static TaskListController CreateControllerForGet(TaskList taskList)
        {
            var stubDao = MockRepository.GenerateStub<ITaskListDao>();

            stubDao.Stub(x => x.GetTaskList(Arg<Guid>.Is.Anything)).Return(taskList);

            return new TaskListController(stubDao);
        }
        private void AssertModel(object model, TaskList taskList)
        {
            Assert.IsInstanceOf<TaskListViewModel>(model);
            TaskListViewModel viewModel = model as TaskListViewModel;

            Assert.AreSame(taskList, viewModel.TaskList);
        }
 public ActionResult Update(Guid taskListId, TaskList taskList)
 {
     taskList.Id = taskListId;
     dao.UpdateTaskList(taskList);
     return new EmptyResult();
 }
        private static TaskListsController CreateControllerForList(TaskList[] taskLists)
        {
            var stubDao = MockRepository.GenerateStub<ITaskListDao>();

            stubDao.Stub(x => x.GetTaskLists()).Return(taskLists);

            return new TaskListsController(stubDao);
        }
 public void UpdateTaskList(TaskList taskList)
 {
     throw new NotImplementedException();
 }
 public void AddTaskList(TaskList newList)
 {
     _taskLists.Add(newList);
 }
        public void UpdateTaskList(TaskList taskList)
        {
            ISession session = _nhibernateHelper.OpenSession();

            TaskList originalTaskList = session.Get<TaskList>(taskList.Id);
            originalTaskList.Name = taskList.Name;

            session.Update(originalTaskList);
            session.Flush();
        }