This repository has been archived by the owner on Apr 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
36b68f6
commit 629c1a3
Showing
6 changed files
with
873 additions
and
1 deletion.
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
63 changes: 63 additions & 0 deletions
63
src/Cake.Issues.PullRequests.Tfs.Tests/CommentExtensionsTests.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,63 @@ | ||
namespace Cake.Issues.PullRequests.Tfs.Tests | ||
{ | ||
using Cake.Issues.Testing; | ||
using Microsoft.TeamFoundation.SourceControl.WebApi; | ||
using Shouldly; | ||
using Xunit; | ||
|
||
public sealed class CommentExtensionsTests | ||
{ | ||
public sealed class TheToPullRequestDiscussionCommentExtension | ||
{ | ||
[Fact] | ||
public void Should_Throw_If_Comment_Is_Null() | ||
{ | ||
// Given | ||
Comment comment = null; | ||
|
||
// When | ||
var result = Record.Exception(() => comment.ToPullRequestDiscussionComment()); | ||
|
||
// Then | ||
result.IsArgumentNullException("comment"); | ||
} | ||
|
||
[Fact] | ||
public void Should_Set_Correct_Content() | ||
{ | ||
// Given | ||
var content = "foo"; | ||
var comment = | ||
new Comment | ||
{ | ||
Content = content | ||
}; | ||
|
||
// When | ||
var result = comment.ToPullRequestDiscussionComment(); | ||
|
||
// Then | ||
result.Content.ShouldBe(content); | ||
} | ||
|
||
[Theory] | ||
[InlineData(true)] | ||
[InlineData(false)] | ||
public void Should_Set_Correct_IsDeleted(bool isDeleted) | ||
{ | ||
// Given | ||
var comment = | ||
new Comment | ||
{ | ||
IsDeleted = isDeleted | ||
}; | ||
|
||
// When | ||
var result = comment.ToPullRequestDiscussionComment(); | ||
|
||
// Then | ||
result.IsDeleted.ShouldBe(isDeleted); | ||
} | ||
} | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
src/Cake.Issues.PullRequests.Tfs.Tests/CommentThreadStatusExtensionsTests.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,85 @@ | ||
namespace Cake.Issues.PullRequests.Tfs.Tests | ||
{ | ||
using Microsoft.TeamFoundation.SourceControl.WebApi; | ||
using Shouldly; | ||
using Xunit; | ||
|
||
public sealed class CommentThreadStatusExtensionsTests | ||
{ | ||
public sealed class TheToPullRequestDiscussionStatusExtension | ||
{ | ||
[Theory] | ||
[InlineData( | ||
CommentThreadStatus.Unknown, | ||
PullRequestDiscussionStatus.Unknown)] | ||
[InlineData( | ||
CommentThreadStatus.Active, | ||
PullRequestDiscussionStatus.Active)] | ||
[InlineData( | ||
CommentThreadStatus.Pending, | ||
PullRequestDiscussionStatus.Active)] | ||
[InlineData( | ||
CommentThreadStatus.Fixed, | ||
PullRequestDiscussionStatus.Resolved)] | ||
[InlineData( | ||
CommentThreadStatus.WontFix, | ||
PullRequestDiscussionStatus.Resolved)] | ||
[InlineData( | ||
CommentThreadStatus.Closed, | ||
PullRequestDiscussionStatus.Resolved)] | ||
[InlineData( | ||
CommentThreadStatus.ByDesign, | ||
PullRequestDiscussionStatus.Resolved)] | ||
public void Should_Return_Correct_Value( | ||
CommentThreadStatus status, | ||
PullRequestDiscussionStatus expectedResult) | ||
{ | ||
// Given | ||
|
||
// When | ||
var result = status.ToPullRequestDiscussionStatus(); | ||
|
||
// Then | ||
result.ShouldBe(expectedResult); | ||
} | ||
} | ||
|
||
public sealed class TheToPullRequestDiscussionResolutionExtension | ||
{ | ||
[Theory] | ||
[InlineData( | ||
CommentThreadStatus.Unknown, | ||
PullRequestDiscussionResolution.Unknown)] | ||
[InlineData( | ||
CommentThreadStatus.Active, | ||
PullRequestDiscussionResolution.Unknown)] | ||
[InlineData( | ||
CommentThreadStatus.Pending, | ||
PullRequestDiscussionResolution.Unknown)] | ||
[InlineData( | ||
CommentThreadStatus.Fixed, | ||
PullRequestDiscussionResolution.Resolved)] | ||
[InlineData( | ||
CommentThreadStatus.WontFix, | ||
PullRequestDiscussionResolution.WontFix)] | ||
[InlineData( | ||
CommentThreadStatus.Closed, | ||
PullRequestDiscussionResolution.Resolved)] | ||
[InlineData( | ||
CommentThreadStatus.ByDesign, | ||
PullRequestDiscussionResolution.Resolved)] | ||
public void Should_Return_Correct_Value( | ||
CommentThreadStatus status, | ||
PullRequestDiscussionResolution expectedResult) | ||
{ | ||
// Given | ||
|
||
// When | ||
var result = status.ToPullRequestDiscussionResolution(); | ||
|
||
// Then | ||
result.ShouldBe(expectedResult); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.