/// <summary> /// Edit Task /// </summary> /// <param name="existing"></param> public EditTaskWindow(TaskItem existing) { InitializeComponent(); vm = new EditTaskWindowViewModel(this, existing); this.DataContext = vm; }
/// <summary> /// Add Task/Subtask /// </summary> /// <param name="list"></param> /// <param name="parent"></param> public EditTaskWindow(TaskList list, TaskItem parent = null) { InitializeComponent(); vm = new EditTaskWindowViewModel(this, list); this.DataContext = vm; vm.SetParent(parent); }
public void CanSaveItemCommandExecute_WhenHaveIdAndName_ReturnsTrue() { var task = new TaskItem { ID = 39, Name = "test" }; var response = false; var vm = new EditTaskWindowViewModel(task, new SimpleEventAggregator()); response = vm.SaveItemCommand.CanExecute(null); Assert.IsTrue(response); }
public void CanSaveItemCommandExecute_WhenFieldsNotFilled_ReturnsFalse(int id, string name) { var task = new TaskItem { ID = id, Name = name }; var response = true; var vm = new EditTaskWindowViewModel(task, new SimpleEventAggregator()); response = vm.SaveItemCommand.CanExecute(null); Assert.IsFalse(response); }