-
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
f0a6aac
commit 60755ab
Showing
10 changed files
with
617 additions
and
185 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
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
95 changes: 95 additions & 0 deletions
95
src/Cake.Tfs.Tests/PullRequest/CommentThread/TfsCommentTests.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,95 @@ | ||
namespace Cake.Tfs.Tests.PullRequest.CommentThread | ||
{ | ||
using Cake.Tfs.PullRequest.CommentThread; | ||
using Microsoft.TeamFoundation.SourceControl.WebApi; | ||
using Shouldly; | ||
using Xunit; | ||
|
||
public sealed class TfsCommentTests | ||
{ | ||
public sealed class TheCtor | ||
{ | ||
[Fact] | ||
public void Should_Throw_If_Comment_Is_Null() | ||
{ | ||
// Given, When | ||
var result = Record.Exception(() => new TfsComment(null)); | ||
|
||
// Then | ||
result.IsArgumentNullException("comment"); | ||
} | ||
|
||
[Fact] | ||
public void Should_Throw_If_Comment_Content_Is_Null() | ||
{ | ||
// Given, When | ||
var result = Record.Exception(() => new TfsComment(null, false)); | ||
|
||
// Then | ||
result.IsArgumentNullException("content"); | ||
} | ||
|
||
[Fact] | ||
public void Should_Throw_If_Comment_Content_Is_Empty() | ||
{ | ||
// Given, When | ||
var result = Record.Exception(() => new TfsComment(string.Empty, false)); | ||
|
||
// Then | ||
result.IsArgumentOutOfRangeException("content"); | ||
} | ||
|
||
[Fact] | ||
public void Should_Return_Empty_Comment() | ||
{ | ||
// Given, When | ||
var comment = new TfsComment(); | ||
|
||
// Then | ||
comment.ShouldNotBeNull(); | ||
comment.Content.ShouldBe(default(string)); | ||
comment.IsDeleted.ShouldBe(default(bool)); | ||
comment.CommentType.ShouldBe(default(TfsCommentType)); | ||
} | ||
|
||
[Fact] | ||
public void Should_Return_Valid_Comment_With_Default_Comment_Type() | ||
{ | ||
// Given, When | ||
var comment = new TfsComment("Hello", false); | ||
|
||
// Then | ||
comment.ShouldNotBeNull(); | ||
comment.Content.ShouldBe("Hello"); | ||
comment.IsDeleted.ShouldBeFalse(); | ||
comment.CommentType.ShouldBe(default(TfsCommentType)); | ||
} | ||
|
||
[Fact] | ||
public void Should_Return_Valid_Comment_Via_With_Specific_Comment_Type() | ||
{ | ||
// Given, When | ||
var comment = new TfsComment("What's up?", true, CommentType.Text); | ||
|
||
// Then | ||
comment.ShouldNotBeNull(); | ||
comment.Content.ShouldBe("What's up?"); | ||
comment.IsDeleted.ShouldBeTrue(); | ||
comment.CommentType.ShouldBe(TfsCommentType.Text); | ||
} | ||
|
||
[Fact] | ||
public void Should_Return_Valid_Comment_Via_Initializers() | ||
{ | ||
// Given, When | ||
var comment = new TfsComment { Content = "All good", IsDeleted = false, CommentType = TfsCommentType.CodeChange }; | ||
|
||
// Then | ||
comment.ShouldNotBeNull(); | ||
comment.Content.ShouldBe("All good"); | ||
comment.IsDeleted.ShouldBeFalse(); | ||
comment.CommentType.ShouldBe(TfsCommentType.CodeChange); | ||
} | ||
} | ||
} | ||
} |
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.