public async void remove_issue_from_sprint_command_fails_when_issue_does_not_exist() { var projectId = "projectKey" + Guid.NewGuid(); var project = new Project(projectId); await _projectMongoDbFixture.InsertAsync(project.AsDocument()); var sprintId = "sprintKey" + Guid.NewGuid(); var title = "Title"; var description = "description"; var createdAt = DateTime.Now; var startedAt = DateTime.MinValue; var startDate = DateTime.MinValue; var endDate = DateTime.MaxValue; var endedAt = DateTime.MaxValue; var sprint = new Sprint(sprintId, title, description, projectId, null, createdAt, startedAt, startDate, endDate, endedAt); await _sprintMongoDbFixture.InsertAsync(sprint.AsDocument()); var issueId = "issueKey" + Guid.NewGuid(); var command = new RemoveIssueFromSprint(sprintId, issueId); // Check if exception is thrown _commandHandler .Awaiting(c => c.HandleAsync(command)) .Should().Throw <IssueNotFoundException>(); }
public async Task remove_issue_from_sprint_command_should_remove_issue_from_sprint() { var projectId = "projectKey" + Guid.NewGuid(); var project = new Project(projectId); await _projectMongoDbFixture.InsertAsync(project.AsDocument()); var sprintId = "sprintKey" + Guid.NewGuid(); var title = "Title"; var description = "description"; var createdAt = DateTime.Now; var startedAt = DateTime.MinValue; var startDate = DateTime.MinValue; var endDate = DateTime.MaxValue; var endedAt = DateTime.MaxValue; var sprint = new Sprint(sprintId, title, description, projectId, null, createdAt, startedAt, startDate, endDate, endedAt); await _sprintMongoDbFixture.InsertAsync(sprint.AsDocument()); var issueId = "issueKey" + Guid.NewGuid(); var issue = new Issue(issueId, projectId, sprintId); await _issueMongoDbFixture.InsertAsync(issue.AsDocument()); var command = new RemoveIssueFromSprint(sprintId, issueId); // Check if exception is thrown _commandHandler .Awaiting(c => c.HandleAsync(command)) .Should().NotThrow(); var removedIssue = await _issueMongoDbFixture.GetAsync(issueId); removedIssue.Should().NotBeNull(); removedIssue.SprintId.Should().BeNull(); }
public async void remove_issue_from_sprint_command_fails_when_sprint_does_not_exist() { var projectId = "projectKey" + Guid.NewGuid(); var project = new Project(projectId); await _projectMongoDbFixture.InsertAsync(project.AsDocument()); var sprintId = "sprintKey" + Guid.NewGuid(); var issueId = "issueKey" + Guid.NewGuid(); var issue = new Issue(issueId, projectId, null); await _issueMongoDbFixture.InsertAsync(issue.AsDocument()); var command = new RemoveIssueFromSprint(sprintId, issueId); // Check if exception is thrown _commandHandler .Awaiting(c => c.HandleAsync(command)) .Should().Throw <SprintNotFoundException>(); }