Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 202b059

Browse files
Fixing tests that compare users by setting the login
1 parent 4a19ad7 commit 202b059

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

test/GitHub.InlineReviews.UnitTests/ViewModels/PullRequestReviewCommentViewModelTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,11 @@ public void CanBeExecutedForCommentsByTheSameAuthor()
5151
var thread = CreateThread();
5252

5353
var currentUser = Substitute.For<IAccount>();
54+
currentUser.Login.Returns("CurrentUser");
5455

5556
var pullRequestReviewCommentModel = Substitute.For<IPullRequestReviewCommentModel>();
5657
pullRequestReviewCommentModel.User.Returns(currentUser);
5758

58-
currentUser.Equals(Arg.Is(currentUser)).Returns(true);
59-
6059
var target = CreateTarget(session, thread, currentUser, pullRequestReviewCommentModel);
6160
Assert.That(target.BeginCreate.CanExecute(new object()), Is.True);
6261
}
@@ -68,13 +67,14 @@ public void CannotBeExecutedForCommentsByAnotherAuthor()
6867
var thread = CreateThread();
6968

7069
var currentUser = Substitute.For<IAccount>();
70+
currentUser.Login.Returns("CurrentUser");
71+
7172
var otherUser = Substitute.For<IAccount>();
73+
currentUser.Login.Returns("OtherUser");
7274

7375
var pullRequestReviewCommentModel = Substitute.For<IPullRequestReviewCommentModel>();
7476
pullRequestReviewCommentModel.User.Returns(otherUser);
7577

76-
currentUser.Equals(Arg.Is(otherUser)).Returns(false);
77-
7878
var target = CreateTarget(session, thread, currentUser, pullRequestReviewCommentModel);
7979
Assert.That(target.BeginCreate.CanExecute(new object()), Is.False);
8080
}
@@ -99,12 +99,11 @@ public void CanBeExecutedForCommentsByTheSameAuthor()
9999
var thread = CreateThread();
100100

101101
var currentUser = Substitute.For<IAccount>();
102+
currentUser.Login.Returns("CurrentUser");
102103

103104
var pullRequestReviewCommentModel = Substitute.For<IPullRequestReviewCommentModel>();
104105
pullRequestReviewCommentModel.User.Returns(currentUser);
105106

106-
currentUser.Equals(Arg.Is(currentUser)).Returns(true);
107-
108107
var target = CreateTarget(session, thread, currentUser, pullRequestReviewCommentModel);
109108
Assert.That(target.Delete.CanExecute(new object()), Is.True);
110109
}
@@ -116,13 +115,14 @@ public void CannotBeExecutedForCommentsByAnotherAuthor()
116115
var thread = CreateThread();
117116

118117
var currentUser = Substitute.For<IAccount>();
118+
currentUser.Login.Returns("CurrentUser");
119+
119120
var otherUser = Substitute.For<IAccount>();
121+
currentUser.Login.Returns("OtherUser");
120122

121123
var pullRequestReviewCommentModel = Substitute.For<IPullRequestReviewCommentModel>();
122124
pullRequestReviewCommentModel.User.Returns(otherUser);
123125

124-
currentUser.Equals(Arg.Is(otherUser)).Returns(false);
125-
126126
var target = CreateTarget(session, thread, currentUser, pullRequestReviewCommentModel);
127127
Assert.That(target.Delete.CanExecute(new object()), Is.False);
128128
}

0 commit comments

Comments
 (0)