public void SetUp() { _repository = new Mock<ITasksRepository>(); _tasksService = new TasksService(_repository.Object); _taskOne = new Task { Id = Guid.NewGuid(), Title = "Task One", Description = "Description One" }; _taskTwo = new Task { Id = Guid.NewGuid(), Title = "Task Two", Description = "Description Two" }; }
public void Initialize() { _server = TestServer.Create<StartUp>(); _repository = new TasksRepository(new RedisClient()); _taskOne = _repository.Save(new Task { Title = "TaskOne" }); _taskTwo = _repository.Save(new Task { Title = "TaskTwo" }); }
public void TaskMapper_ToModel() { var taskEntity = new Task { Id = Guid.NewGuid(), Title = "title", Description = "description", State = StateTask.InProgress }; var taskModel = _taskMapper.ToModel(taskEntity); Assert.IsInstanceOfType(taskModel, typeof(TaskModel)); Assert.AreEqual(taskEntity.Id, taskModel.id); Assert.AreEqual(StateTaskModel.InProgress, taskModel.state); Assert.AreEqual(taskEntity.Description, taskModel.description); }
public TaskModel ToModel(Task entity) { return AutoMapper.Mapper.Map<TaskModel>(entity); }
public void TasksRepository_Update() { var task = new Task { Title = "Task One" }; var taskSaved = _repository.Save(task); taskSaved.Title = "Name Updated"; var taskUpdated = _repository.Update(taskSaved); Assert.AreEqual(taskUpdated.Id, taskSaved.Id); Assert.AreEqual(taskUpdated.Title, taskSaved.Title); _repository.Delete(task.Id); }
public Task Update(Task task) { return _tasksRepository.Update(task); }
public Task Save(Task task) { return _tasksRepository.Save(task); }
public bool IsValidTaskForUpdate(Task task) { return !string.IsNullOrWhiteSpace(task.Title) && task.Id != null && task.Id != Guid.Empty; }
public bool IsValidTaskForInsert(Task task) { return !string.IsNullOrWhiteSpace(task.Title); }
public Task Update(Task task) { return _redisClient.Store(task); }
public Task Save(Task task) { task.Id = Guid.NewGuid(); return _redisClient.Store(task); }