Skip to content

Commit

Permalink
fix: fix some compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hamed-shirbandi committed Sep 27, 2023
1 parent e7a3198 commit bb2bf54
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public AddTaskUseCase(ITaskAggregateRepository taskAggregateRepository, IMessage
/// </summary>
public async Task<CommandResult> Handle(AddTaskRequest request, CancellationToken cancellationToken)
{
var task = Domain.Entities.Task.AddTask(request.Title, request.Description,request.CardId, request.BoardId, _taskValidatorService);
var task = Domain.Tasks.Entities.Task.AddTask(request.Title, request.Description,request.CardId, request.BoardId, _taskValidatorService);

await _taskAggregateRepository.AddAsync(task);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public abstract class TestsBaseFixture : UnitTestsBase
protected IInMemoryBus InMemoryBus;
protected ITaskAggregateRepository TaskAggregateRepository;
protected ITaskValidatorService TaskValidatorService;
protected List<Api.Domain.Entities.Task> Tasks;
protected List<Api.Domain.Tasks.Entities.Task> Tasks;



Expand Down Expand Up @@ -54,25 +54,25 @@ private void CommonFixtureSetup()

TaskAggregateRepository = Substitute.For<ITaskAggregateRepository>();
TaskAggregateRepository.GetByIdAsync(Arg.Is<string>(x => Tasks.Any(o => o.Id == x))).Returns(args => Tasks.First(u => u.Id == (string)args[0]));
TaskAggregateRepository.AddAsync(Arg.Any<Api.Domain.Entities.Task>()).Returns(args => { Tasks.Add((Api.Domain.Entities.Task)args[0]); return Task.CompletedTask; });
TaskAggregateRepository.UpdateAsync(Arg.Is<Api.Domain.Entities.Task>(x => Tasks.Any(o => o.Id == x.Id))).Returns(args =>
TaskAggregateRepository.AddAsync(Arg.Any<Api.Domain.Tasks.Entities.Task>()).Returns(args => { Tasks.Add((Api.Domain.Tasks.Entities.Task)args[0]); return Task.CompletedTask; });
TaskAggregateRepository.UpdateAsync(Arg.Is<Api.Domain.Tasks.Entities.Task>(x => Tasks.Any(o => o.Id == x.Id))).Returns(args =>
{
var existTask = Tasks.FirstOrDefault(u => u.Id == ((Api.Domain.Entities.Task)args[0]).Id);
var existTask = Tasks.FirstOrDefault(u => u.Id == ((Api.Domain.Tasks.Entities.Task)args[0]).Id);
if (existTask != null)
{
Tasks.Remove(existTask);
Tasks.Add(((Api.Domain.Entities.Task)args[0]));
Tasks.Add(((Api.Domain.Tasks.Entities.Task)args[0]));
}

return Task.CompletedTask;
});
TaskAggregateRepository.ConcurrencySafeUpdate(Arg.Is<Api.Domain.Entities.Task>(x => Tasks.Any(o => o.Id == x.Id)),Arg.Is<string>(x=>x.Any())).Returns(args =>
TaskAggregateRepository.ConcurrencySafeUpdate(Arg.Is<Api.Domain.Tasks.Entities.Task>(x => Tasks.Any(o => o.Id == x.Id)),Arg.Is<string>(x=>x.Any())).Returns(args =>
{
var existTask = Tasks.FirstOrDefault(u => u.Id == ((Api.Domain.Entities.Task)args[0]).Id && u.Version == (string)args[1]);
var existTask = Tasks.FirstOrDefault(u => u.Id == ((Api.Domain.Tasks.Entities.Task)args[0]).Id && u.Version == (string)args[1]);
if (existTask != null)
{
Tasks.Remove(existTask);
Tasks.Add(((Api.Domain.Entities.Task)args[0]));
Tasks.Add(((Api.Domain.Tasks.Entities.Task)args[0]));
}

return Task.CompletedTask;
Expand Down Expand Up @@ -103,7 +103,7 @@ private void CommonFixtureSetup()
/// <summary>
///
/// </summary>
private List<Api.Domain.Entities.Task> GenerateTasksList()
private List<Api.Domain.Tasks.Entities.Task> GenerateTasksList()
{
var taskValidatorService = Substitute.For<ITaskValidatorService>();
taskValidatorService.TaskHasUniqueName(taskId: Arg.Any<string>(), boardId: Arg.Any<string>(), taskTitle: Arg.Any<string>()).Returns(true);
Expand Down

0 comments on commit bb2bf54

Please sign in to comment.