Beispiel #1
0
        public int AddTask(AddTaskArgs args)
        {
            var task = mapper.ConvertArgsToTask(args);
            var id   = repo.AddTask(task);

            return(id);
        }
        public void should_add_task_return_id()
        {
            var args = new AddTaskArgs();

            todoList.AddTask(args).Returns(1);

            var result = service.AddTask(args);

            result.Should().Be(1);
        }
Beispiel #3
0
        public void should_return_task_id_on_add_task()
        {
            var args        = new ServiceTask();
            var addTaskArgs = new AddTaskArgs();

            mapper.ConvertArgsToTask(addTaskArgs).Returns(args);

            repo.AddTask(args).Returns(1);
            var result = todoList.AddTask(addTaskArgs);

            result.Should().Be(1);
        }
        public void should_add_task_to_service()
        {
            const string myname = "myName";
            var          args   = new AddTaskArgs {
                Name = myname
            };

            service.AddTask(Arg.Is <AddTaskArgs>(a => a.Name == myname)).Returns(1);
            var result = client.AddTask(args);

            Console.Out.WriteLine(result);
            host.Close();

            result.Should().Be(1);
        }
 public int AddTask(AddTaskArgs args)
 {
     return(GetDataFromServer(t => t.AddTask(args)));
 }
 public int AddTask(AddTaskArgs task)
 {
     return(todoList.AddTask(task));
 }
Beispiel #7
0
 public ServiceTask ConvertArgsToTask(AddTaskArgs args)
 {
     return(new ServiceTask {
         Name = args.Name, DueDate = args.DueDate == null ? default(DateTime) : args.DueDate.Value
     });
 }