-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add doc and test for AddCommentForIssue method
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
tests/YouTrackSharp.Tests/Integration/Issues/Comments/AddCommentForIssue.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
using YouTrackSharp.Tests.Infrastructure; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace YouTrackSharp.Tests.Integration.Issues | ||
{ | ||
public partial class IssuesServiceTests | ||
{ | ||
public class AddCommentForIssue | ||
{ | ||
[Fact] | ||
public async Task Valid_Connection_Adds_Comment_For_Issue() | ||
{ | ||
// Arrange | ||
var connection = Connections.Demo1Token; | ||
using (var temporaryIssueContext = await TemporaryIssueContext.Create(connection, GetType())) | ||
{ | ||
var service = connection.CreateIssuesService(); | ||
var commentText = "Test comment " + DateTime.UtcNow.ToString("U"); | ||
|
||
// Act | ||
await service.AddCommentForIssue(temporaryIssueContext.Issue.Id, commentText); | ||
|
||
// Assert | ||
var comments = await service.GetCommentsForIssue(temporaryIssueContext.Issue.Id); | ||
|
||
Assert.NotNull(comments.FirstOrDefault(comment => comment.Text.Equals(commentText))); | ||
|
||
await temporaryIssueContext.Destroy(); | ||
} | ||
} | ||
} | ||
} | ||
} |