Skip to content

Commit b9bd9c8

Browse files
yorahnulltoken
authored andcommitted
Replace AssertExtensions.ShouldEqual method by Assert.Equal
1 parent 9bb8408 commit b9bd9c8

18 files changed

+345
-354
lines changed

LibGit2Sharp.Tests/BlobFixture.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public void CanGetBlobAsUtf8()
1515
var blob = repo.Lookup<Blob>("a8233120f6ad708f843d861ce2b7228ec4e3dec6");
1616

1717
string text = blob.ContentAsUtf8();
18-
text.ShouldEqual("hey there\n");
18+
Assert.Equal("hey there\n", text);
1919
}
2020
}
2121

@@ -25,7 +25,7 @@ public void CanGetBlobSize()
2525
using (var repo = new Repository(BareTestRepoPath))
2626
{
2727
var blob = repo.Lookup<Blob>("a8233120f6ad708f843d861ce2b7228ec4e3dec6");
28-
blob.Size.ShouldEqual(10);
28+
Assert.Equal(10, blob.Size);
2929
}
3030
}
3131

@@ -46,10 +46,10 @@ public void CanReadBlobContent()
4646
{
4747
var blob = repo.Lookup<Blob>("a8233120f6ad708f843d861ce2b7228ec4e3dec6");
4848
byte[] bytes = blob.Content;
49-
bytes.Length.ShouldEqual(10);
49+
Assert.Equal(10, bytes.Length);
5050

5151
string content = Encoding.UTF8.GetString(bytes);
52-
content.ShouldEqual("hey there\n");
52+
Assert.Equal("hey there\n", content);
5353
}
5454
}
5555

@@ -63,7 +63,7 @@ public void CanReadBlobStream()
6363
using (var tr = new StreamReader(blob.ContentStream, Encoding.UTF8))
6464
{
6565
string content = tr.ReadToEnd();
66-
content.ShouldEqual("hey there\n");
66+
Assert.Equal("hey there\n", content);
6767
}
6868
}
6969
}
@@ -97,7 +97,7 @@ public void CanStageAFileGeneratedFromABlobContentStream()
9797

9898
repo.Index.Stage("small.txt");
9999
IndexEntry entry = repo.Index["small.txt"];
100-
entry.Id.Sha.ShouldEqual("baae1fb3760a73481ced1fa03dc15614142c19ef");
100+
Assert.Equal("baae1fb3760a73481ced1fa03dc15614142c19ef", entry.Id.Sha);
101101

102102
var blob = repo.Lookup<Blob>(entry.Id.Sha);
103103

@@ -110,7 +110,7 @@ public void CanStageAFileGeneratedFromABlobContentStream()
110110
repo.Index.Stage("small.fromblob.txt");
111111
IndexEntry newentry = repo.Index["small.fromblob.txt"];
112112

113-
newentry.Id.Sha.ShouldEqual("baae1fb3760a73481ced1fa03dc15614142c19ef");
113+
Assert.Equal("baae1fb3760a73481ced1fa03dc15614142c19ef", newentry.Id.Sha);
114114
}
115115
}
116116
}

LibGit2Sharp.Tests/BranchFixture.cs

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ public void CanCreateBranch(string name)
2020
{
2121
Branch newBranch = repo.CreateBranch(name, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
2222
newBranch.ShouldNotBeNull();
23-
newBranch.Name.ShouldEqual(name);
24-
newBranch.CanonicalName.ShouldEqual("refs/heads/" + name);
23+
Assert.Equal(name, newBranch.Name);
24+
Assert.Equal("refs/heads/" + name, newBranch.CanonicalName);
2525
newBranch.Tip.ShouldNotBeNull();
26-
newBranch.Tip.Sha.ShouldEqual("be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
26+
Assert.Equal("be3563ae3f795b2b4353bcce3a527ad0a4f7f644", newBranch.Tip.Sha);
2727
repo.Branches.SingleOrDefault(p => p.Name == name).ShouldNotBeNull();
2828

2929
repo.Branches.Delete(newBranch.Name);
@@ -38,8 +38,8 @@ public void CanCreateBranchUsingAbbreviatedSha()
3838
{
3939
const string name = "unit_test";
4040
Branch newBranch = repo.CreateBranch(name, "be3563a");
41-
newBranch.CanonicalName.ShouldEqual("refs/heads/" + name);
42-
newBranch.Tip.Sha.ShouldEqual("be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
41+
Assert.Equal("refs/heads/" + name, newBranch.CanonicalName);
42+
Assert.Equal("be3563ae3f795b2b4353bcce3a527ad0a4f7f644", newBranch.Tip.Sha);
4343
}
4444
}
4545

@@ -52,11 +52,11 @@ public void CanCreateBranchFromImplicitHead()
5252
const string name = "unit_test";
5353
Branch newBranch = repo.CreateBranch(name);
5454
newBranch.ShouldNotBeNull();
55-
newBranch.Name.ShouldEqual(name);
56-
newBranch.CanonicalName.ShouldEqual("refs/heads/" + name);
55+
Assert.Equal(name, newBranch.Name);
56+
Assert.Equal("refs/heads/" + name, newBranch.CanonicalName);
5757
Assert.False(newBranch.IsCurrentRepositoryHead);
5858
newBranch.Tip.ShouldNotBeNull();
59-
newBranch.Tip.Sha.ShouldEqual("4c062a6361ae6959e06292c1fa5e2822d9c96345");
59+
Assert.Equal("4c062a6361ae6959e06292c1fa5e2822d9c96345", newBranch.Tip.Sha);
6060
repo.Branches.SingleOrDefault(p => p.Name == name).ShouldNotBeNull();
6161
}
6262
}
@@ -70,7 +70,7 @@ public void CanCreateBranchFromExplicitHead()
7070
const string name = "unit_test";
7171
Branch newBranch = repo.CreateBranch(name, "HEAD");
7272
newBranch.ShouldNotBeNull();
73-
newBranch.Tip.Sha.ShouldEqual("4c062a6361ae6959e06292c1fa5e2822d9c96345");
73+
Assert.Equal("4c062a6361ae6959e06292c1fa5e2822d9c96345", newBranch.Tip.Sha);
7474
}
7575
}
7676

@@ -84,7 +84,7 @@ public void CanCreateBranchFromCommit()
8484
var commit = repo.Lookup<Commit>("HEAD");
8585
Branch newBranch = repo.CreateBranch(name, commit);
8686
newBranch.ShouldNotBeNull();
87-
newBranch.Tip.Sha.ShouldEqual("4c062a6361ae6959e06292c1fa5e2822d9c96345");
87+
Assert.Equal("4c062a6361ae6959e06292c1fa5e2822d9c96345", newBranch.Tip.Sha);
8888
}
8989
}
9090

@@ -97,7 +97,7 @@ public void CreatingABranchFromATagPeelsToTheCommit()
9797
const string name = "i-peel-tag";
9898
Branch newBranch = repo.CreateBranch(name, "refs/tags/test");
9999
newBranch.ShouldNotBeNull();
100-
newBranch.Tip.Sha.ShouldEqual("e90810b8df3e80c413d903f631643c716887138d");
100+
Assert.Equal("e90810b8df3e80c413d903f631643c716887138d", newBranch.Tip.Sha);
101101
}
102102
}
103103

@@ -111,7 +111,7 @@ public void CreatingABranchTriggersTheCreationOfADirectReference()
111111
Assert.False(newBranch.IsCurrentRepositoryHead);
112112

113113
ObjectId commitId = repo.Head.Tip.Id;
114-
newBranch.Tip.Id.ShouldEqual(commitId);
114+
Assert.Equal(commitId, newBranch.Tip.Id);
115115

116116
Reference reference = repo.Refs[newBranch.CanonicalName];
117117
reference.ShouldNotBeNull();
@@ -179,7 +179,7 @@ public void CanListAllBranches()
179179
{
180180
Assert.Equal(expectedBranches, repo.Branches.Select(b => b.Name).ToArray());
181181

182-
repo.Branches.Count().ShouldEqual(5);
182+
Assert.Equal(5, repo.Branches.Count());
183183
}
184184
}
185185

@@ -222,13 +222,13 @@ public void CanLookupABranchByItsCanonicalName()
222222
{
223223
Branch branch = repo.Branches["refs/heads/br2"];
224224
branch.ShouldNotBeNull();
225-
branch.Name.ShouldEqual("br2");
225+
Assert.Equal("br2", branch.Name);
226226

227227
Branch branch2 = repo.Branches["refs/heads/br2"];
228228
branch2.ShouldNotBeNull();
229-
branch2.Name.ShouldEqual("br2");
229+
Assert.Equal("br2", branch2.Name);
230230

231-
branch2.ShouldEqual(branch);
231+
Assert.Equal(branch, branch2);
232232
(branch2 == branch).ShouldBeTrue();
233233
}
234234
}
@@ -241,10 +241,10 @@ public void CanLookupLocalBranch()
241241
Branch master = repo.Branches["master"];
242242
master.ShouldNotBeNull();
243243
Assert.False(master.IsRemote);
244-
master.Name.ShouldEqual("master");
245-
master.CanonicalName.ShouldEqual("refs/heads/master");
244+
Assert.Equal("master", master.Name);
245+
Assert.Equal("refs/heads/master", master.CanonicalName);
246246
master.IsCurrentRepositoryHead.ShouldBeTrue();
247-
master.Tip.Sha.ShouldEqual("4c062a6361ae6959e06292c1fa5e2822d9c96345");
247+
Assert.Equal("4c062a6361ae6959e06292c1fa5e2822d9c96345", master.Tip.Sha);
248248
}
249249
}
250250

@@ -260,7 +260,7 @@ public void CanLookupABranchWhichNameIsMadeOfNon7BitsAsciiCharacters()
260260

261261
Branch retrieved = repo.Branches["Ångström"];
262262
retrieved.ShouldNotBeNull();
263-
retrieved.Tip.ShouldEqual(newBranch.Tip);
263+
Assert.Equal(newBranch.Tip, retrieved.Tip);
264264
}
265265
}
266266

@@ -283,8 +283,8 @@ public void TrackingInformationIsEmptyForNonTrackingBranch()
283283
Branch branch = repo.Branches["test"];
284284
Assert.False(branch.IsTracking);
285285
branch.TrackedBranch.ShouldBeNull();
286-
branch.AheadBy.ShouldEqual(0);
287-
branch.BehindBy.ShouldEqual(0);
286+
Assert.Equal(0, branch.AheadBy);
287+
Assert.Equal(0, branch.BehindBy);
288288
}
289289
}
290290

@@ -295,9 +295,9 @@ public void CanGetTrackingInformationForTrackingBranch()
295295
{
296296
Branch master = repo.Branches["master"];
297297
master.IsTracking.ShouldBeTrue();
298-
master.TrackedBranch.ShouldEqual(repo.Branches["refs/remotes/origin/master"]);
299-
master.AheadBy.ShouldEqual(2);
300-
master.BehindBy.ShouldEqual(2);
298+
Assert.Equal(repo.Branches["refs/remotes/origin/master"], master.TrackedBranch);
299+
Assert.Equal(2, master.AheadBy);
300+
Assert.Equal(2, master.BehindBy);
301301
}
302302
}
303303

@@ -308,9 +308,9 @@ public void CanGetTrackingInformationForLocalTrackingBranch()
308308
{
309309
var branch = repo.Branches["track-local"];
310310
branch.IsTracking.ShouldBeTrue();
311-
branch.TrackedBranch.ShouldEqual(repo.Branches["master"]);
312-
branch.AheadBy.ShouldEqual(2);
313-
branch.BehindBy.ShouldEqual(2);
311+
Assert.Equal(repo.Branches["master"], branch.TrackedBranch);
312+
Assert.Equal(2, branch.AheadBy);
313+
Assert.Equal(2, branch.BehindBy);
314314
}
315315
}
316316

@@ -320,7 +320,7 @@ public void CanWalkCommitsFromAnotherBranch()
320320
using (var repo = new Repository(BareTestRepoPath))
321321
{
322322
Branch master = repo.Branches["test"];
323-
master.Commits.Count().ShouldEqual(2);
323+
Assert.Equal(2, master.Commits.Count());
324324
}
325325
}
326326

@@ -330,7 +330,7 @@ public void CanWalkCommitsFromBranch()
330330
using (var repo = new Repository(BareTestRepoPath))
331331
{
332332
Branch master = repo.Branches["master"];
333-
master.Commits.Count().ShouldEqual(7);
333+
Assert.Equal(7, master.Commits.Count());
334334
}
335335
}
336336

@@ -353,7 +353,7 @@ public void CanCheckoutAnExistingBranch(string name)
353353

354354
Assert.False(test.IsRemote);
355355
test.IsCurrentRepositoryHead.ShouldBeTrue();
356-
test.ShouldEqual(repo.Head);
356+
Assert.Equal(repo.Head, test);
357357

358358
Assert.False(master.IsCurrentRepositoryHead);
359359
}
@@ -375,7 +375,7 @@ public void CanCheckoutAnExistingBranchByName(string name)
375375

376376
Assert.False(test.IsRemote);
377377
test.IsCurrentRepositoryHead.ShouldBeTrue();
378-
test.ShouldEqual(repo.Head);
378+
Assert.Equal(repo.Head, test);
379379

380380
Assert.False(master.IsCurrentRepositoryHead);
381381
}
@@ -397,11 +397,11 @@ public void CanCheckoutAnArbitraryCommit(string commitPointer)
397397
repo.Info.IsHeadDetached.ShouldBeTrue();
398398

399399
Assert.False(detachedHead.IsRemote);
400-
detachedHead.CanonicalName.ShouldEqual(detachedHead.Name);
401-
detachedHead.CanonicalName.ShouldEqual("(no branch)");
402-
detachedHead.Tip.Sha.ShouldEqual(repo.Lookup(commitPointer).Sha);
400+
Assert.Equal(detachedHead.Name, detachedHead.CanonicalName);
401+
Assert.Equal("(no branch)", detachedHead.CanonicalName);
402+
Assert.Equal(repo.Lookup(commitPointer).Sha, detachedHead.Tip.Sha);
403403

404-
detachedHead.ShouldEqual(repo.Head);
404+
Assert.Equal(repo.Head, detachedHead);
405405

406406
Assert.False(master.IsCurrentRepositoryHead);
407407
detachedHead.IsCurrentRepositoryHead.ShouldBeTrue();
@@ -533,7 +533,7 @@ public void CanMoveABranch()
533533
repo.Branches["br3"].ShouldBeNull();
534534

535535
Branch newBranch = repo.Branches.Move("br2", "br3");
536-
newBranch.Name.ShouldEqual("br3");
536+
Assert.Equal("br3", newBranch.Name);
537537

538538
repo.Branches["br2"].ShouldBeNull();
539539
repo.Branches["br3"].ShouldNotBeNull();
@@ -562,15 +562,15 @@ public void CanMoveABranchWhileOverwritingAnExistingOne()
562562
br2.ShouldNotBeNull();
563563

564564
Branch newBranch = repo.Branches.Move("br2", "test", true);
565-
newBranch.Name.ShouldEqual("test");
565+
Assert.Equal("test", newBranch.Name);
566566

567567
repo.Branches["br2"].ShouldBeNull();
568568

569569
Branch newTest = repo.Branches["test"];
570570
newTest.ShouldNotBeNull();
571-
newTest.ShouldEqual(newBranch);
571+
Assert.Equal(newBranch, newTest);
572572

573-
newTest.Tip.ShouldEqual(br2.Tip);
573+
Assert.Equal(br2.Tip, newTest.Tip);
574574
}
575575
}
576576
}

LibGit2Sharp.Tests/CommitAncestorFixture.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void CanFindCommonAncestorForTwoCommits()
3939
Commit ancestor = repo.Commits.FindCommonAncestor(first, second);
4040

4141
Assert.NotNull(ancestor);
42-
ancestor.Id.Sha.ShouldEqual("5b5b025afb0b4c913b4c338a42934a3863bf3644");
42+
Assert.Equal("5b5b025afb0b4c913b4c338a42934a3863bf3644", ancestor.Id.Sha);
4343
}
4444
}
4545

@@ -54,7 +54,7 @@ public void CanFindCommonAncestorForTwoCommitsAsEnumerable()
5454
Commit ancestor = repo.Commits.FindCommonAncestor(new[] { first, second });
5555

5656
Assert.NotNull(ancestor);
57-
ancestor.Id.Sha.ShouldEqual("5b5b025afb0b4c913b4c338a42934a3863bf3644");
57+
Assert.Equal("5b5b025afb0b4c913b4c338a42934a3863bf3644", ancestor.Id.Sha);
5858
}
5959
}
6060

@@ -71,7 +71,7 @@ public void CanFindCommonAncestorForSeveralCommits()
7171
Commit ancestor = repo.Commits.FindCommonAncestor(new[] { first, second, third, fourth });
7272

7373
Assert.NotNull(ancestor);
74-
ancestor.Id.Sha.ShouldEqual("5b5b025afb0b4c913b4c338a42934a3863bf3644");
74+
Assert.Equal("5b5b025afb0b4c913b4c338a42934a3863bf3644", ancestor.Id.Sha);
7575
}
7676
}
7777

0 commit comments

Comments
 (0)