public void AddTask_CreateRecursiveSubtask_ThrowsExeption() { var task = this.CreateTask(null); var action = new AddTaskAction(string.Empty, task.Address, task); Assert.Throws <ArgumentException>(() => this.permissionManager.ExecuteAction(action)); }
public void AddTask_AsSubtask() { var task = this.CreateTask(null); var subTask = this.CreateTask(null); var action = new AddTaskAction(string.Empty, task.Address, subTask); this.permissionManager.ExecuteAction(action); Assert.Contains(subTask.Address, task.SubTasks); }
public void AddTask() { var task = this.CreateTask(null); var addAction = new AddTaskAction(string.Empty, this.taskRegistry.Address, task); this.permissionManager.ExecuteAction(addAction); ISet <Address> tasks = this.taskRegistry.GetAllTasks(); Assert.Contains(task.Address, tasks); }
protected bool HandleAddTask(AddTaskAction action) { var task = action.Task; if (task.Address == null || task.Address.CompareTo(this.Address) == 0) { throw new ArgumentException(); } return(this.SubTasks.Add(action.Task.Address)); }
public void AddTask_WhenDuplicates_RemainsSingle() { var task = this.CreateTask(null); var addAction = new AddTaskAction(string.Empty, this.taskRegistry.Address, task); this.permissionManager.ExecuteAction(addAction); addAction = new AddTaskAction(string.Empty, this.taskRegistry.Address, task); this.permissionManager.ExecuteAction(addAction); IEnumerable <Address> tasks = this.taskRegistry.GetAllTasks().Where(x => x.Equals(task.Address)); Assert.Single(tasks); }
private bool HandleAddTask(AddTaskAction action) { Task task = action.Task; if (task.TokenReceiver.CompareTo(this.DefaultTokenSplitter) != 0) { var changeReceiverAction = new ChnageTaskRewardReceiverAction( string.Empty, task.Address, this.DefaultTokenSplitter); this.OnSend(changeReceiverAction); } // maybe should also remove contract from registry return(this.tasksAddresses.Add(action.Task.Address)); }
public static ImmutableArray <TaskModel> AddTodoReducer(ImmutableArray <TaskModel> previousState, AddTaskAction action) { return(previousState .Insert(0, new TaskModel { Id = action.Id, UserName = action.UserName, Email = action.Email, Text = action.Text, Status = action.Status })); }