Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e02f76b

Browse files
yorahnulltoken
authored andcommitted
Replace AssertExtensions.ShouldBeTrue method by Assert.True
1 parent 0072b7e commit e02f76b

12 files changed

+58
-63
lines changed

LibGit2Sharp.Tests/BranchFixture.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public void CanLookupABranchByItsCanonicalName()
229229
Assert.Equal("br2", branch2.Name);
230230

231231
Assert.Equal(branch, branch2);
232-
(branch2 == branch).ShouldBeTrue();
232+
Assert.True((branch2 == branch));
233233
}
234234
}
235235

@@ -243,7 +243,7 @@ public void CanLookupLocalBranch()
243243
Assert.False(master.IsRemote);
244244
Assert.Equal("master", master.Name);
245245
Assert.Equal("refs/heads/master", master.CanonicalName);
246-
master.IsCurrentRepositoryHead.ShouldBeTrue();
246+
Assert.True(master.IsCurrentRepositoryHead);
247247
Assert.Equal("4c062a6361ae6959e06292c1fa5e2822d9c96345", master.Tip.Sha);
248248
}
249249
}
@@ -294,7 +294,7 @@ public void CanGetTrackingInformationForTrackingBranch()
294294
using (var repo = new Repository(StandardTestRepoPath))
295295
{
296296
Branch master = repo.Branches["master"];
297-
master.IsTracking.ShouldBeTrue();
297+
Assert.True(master.IsTracking);
298298
Assert.Equal(repo.Branches["refs/remotes/origin/master"], master.TrackedBranch);
299299
Assert.Equal(2, master.AheadBy);
300300
Assert.Equal(2, master.BehindBy);
@@ -307,7 +307,7 @@ public void CanGetTrackingInformationForLocalTrackingBranch()
307307
using (var repo = new Repository(StandardTestRepoPath))
308308
{
309309
var branch = repo.Branches["track-local"];
310-
branch.IsTracking.ShouldBeTrue();
310+
Assert.True(branch.IsTracking);
311311
Assert.Equal(repo.Branches["master"], branch.TrackedBranch);
312312
Assert.Equal(2, branch.AheadBy);
313313
Assert.Equal(2, branch.BehindBy);
@@ -343,7 +343,7 @@ public void CanCheckoutAnExistingBranch(string name)
343343
using (var repo = new Repository(path.RepositoryPath))
344344
{
345345
Branch master = repo.Branches["master"];
346-
master.IsCurrentRepositoryHead.ShouldBeTrue();
346+
Assert.True(master.IsCurrentRepositoryHead);
347347

348348
Branch branch = repo.Branches[name];
349349
branch.ShouldNotBeNull();
@@ -352,7 +352,7 @@ public void CanCheckoutAnExistingBranch(string name)
352352
Assert.False(repo.Info.IsHeadDetached);
353353

354354
Assert.False(test.IsRemote);
355-
test.IsCurrentRepositoryHead.ShouldBeTrue();
355+
Assert.True(test.IsCurrentRepositoryHead);
356356
Assert.Equal(repo.Head, test);
357357

358358
Assert.False(master.IsCurrentRepositoryHead);
@@ -368,13 +368,13 @@ public void CanCheckoutAnExistingBranchByName(string name)
368368
using (var repo = new Repository(path.RepositoryPath))
369369
{
370370
Branch master = repo.Branches["master"];
371-
master.IsCurrentRepositoryHead.ShouldBeTrue();
371+
Assert.True(master.IsCurrentRepositoryHead);
372372

373373
Branch test = repo.Checkout(name);
374374
Assert.False(repo.Info.IsHeadDetached);
375375

376376
Assert.False(test.IsRemote);
377-
test.IsCurrentRepositoryHead.ShouldBeTrue();
377+
Assert.True(test.IsCurrentRepositoryHead);
378378
Assert.Equal(repo.Head, test);
379379

380380
Assert.False(master.IsCurrentRepositoryHead);
@@ -390,11 +390,11 @@ public void CanCheckoutAnArbitraryCommit(string commitPointer)
390390
using (var repo = new Repository(path.RepositoryPath))
391391
{
392392
Branch master = repo.Branches["master"];
393-
master.IsCurrentRepositoryHead.ShouldBeTrue();
393+
Assert.True(master.IsCurrentRepositoryHead);
394394

395395
Branch detachedHead = repo.Checkout(commitPointer);
396396

397-
repo.Info.IsHeadDetached.ShouldBeTrue();
397+
Assert.True(repo.Info.IsHeadDetached);
398398

399399
Assert.False(detachedHead.IsRemote);
400400
Assert.Equal(detachedHead.Name, detachedHead.CanonicalName);
@@ -404,8 +404,8 @@ public void CanCheckoutAnArbitraryCommit(string commitPointer)
404404
Assert.Equal(repo.Head, detachedHead);
405405

406406
Assert.False(master.IsCurrentRepositoryHead);
407-
detachedHead.IsCurrentRepositoryHead.ShouldBeTrue();
408-
repo.Head.IsCurrentRepositoryHead.ShouldBeTrue();
407+
Assert.True(detachedHead.IsCurrentRepositoryHead);
408+
Assert.True(repo.Head.IsCurrentRepositoryHead);
409409
}
410410
}
411411

LibGit2Sharp.Tests/CommitFixture.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void CanEnumerateCommitsWithReverseTimeSorting()
138138
foreach (Commit commit in repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = GitSortOptions.Time | GitSortOptions.Reverse }))
139139
{
140140
commit.ShouldNotBeNull();
141-
commit.Sha.StartsWith(reversedShas[count]).ShouldBeTrue();
141+
Assert.True(commit.Sha.StartsWith(reversedShas[count]));
142142
count++;
143143
}
144144
}
@@ -181,7 +181,7 @@ public void CanEnumerateCommitsWithTimeSorting()
181181
foreach (Commit commit in repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = GitSortOptions.Time }))
182182
{
183183
commit.ShouldNotBeNull();
184-
commit.Sha.StartsWith(expectedShas[count]).ShouldBeTrue();
184+
Assert.True(commit.Sha.StartsWith(expectedShas[count]));
185185
count++;
186186
}
187187
}
@@ -447,8 +447,8 @@ public void CanCommitWithSignatureFromConfig()
447447
using (var repo = Repository.Init(scd.DirectoryPath))
448448
{
449449
string dir = repo.Info.Path;
450-
Path.IsPathRooted(dir).ShouldBeTrue();
451-
Directory.Exists(dir).ShouldBeTrue();
450+
Assert.True(Path.IsPathRooted(dir));
451+
Assert.True(Directory.Exists(dir));
452452

453453
InconclusiveIf(() => !repo.Config.HasGlobalConfig, "No Git global configuration available");
454454

@@ -484,8 +484,8 @@ public void CanCommitALittleBit()
484484
using (var repo = Repository.Init(scd.DirectoryPath))
485485
{
486486
string dir = repo.Info.Path;
487-
Path.IsPathRooted(dir).ShouldBeTrue();
488-
Directory.Exists(dir).ShouldBeTrue();
487+
Assert.True(Path.IsPathRooted(dir));
488+
Assert.True(Directory.Exists(dir));
489489

490490
const string relativeFilepath = "new.txt";
491491
string filePath = Path.Combine(repo.Info.WorkingDirectory, relativeFilepath);

LibGit2Sharp.Tests/ConfigurationFixture.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void CanDeleteConfiguration()
5959
Assert.False(repo.Config.Get<bool>("unittests.boolsetting", false));
6060

6161
repo.Config.Set("unittests.boolsetting", true);
62-
repo.Config.Get<bool>("unittests.boolsetting", false).ShouldBeTrue();
62+
Assert.True(repo.Config.Get<bool>("unittests.boolsetting", false));
6363

6464
repo.Config.Delete("unittests.boolsetting");
6565

@@ -275,7 +275,7 @@ public void ReadingValueThatDoesntExistReturnsDefault()
275275
Assert.Equal("42", repo.Config.Get("unittests.ghostsetting", "42"));
276276
Assert.Equal(42, repo.Config.Get("unittests.ghostsetting", 42));
277277
Assert.Equal(42L, repo.Config.Get("unittests.ghostsetting", 42L));
278-
repo.Config.Get("unittests.ghostsetting", true).ShouldBeTrue();
278+
Assert.True(repo.Config.Get("unittests.ghostsetting", true));
279279
}
280280
}
281281

LibGit2Sharp.Tests/IndexFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public void CanStageANewFileWithAFullPath()
232232

233233
const string filename = "new_untracked_file.txt";
234234
string fullPath = Path.Combine(repo.Info.WorkingDirectory, filename);
235-
File.Exists(fullPath).ShouldBeTrue();
235+
Assert.True(File.Exists(fullPath));
236236

237237
repo.Index.Stage(fullPath);
238238

LibGit2Sharp.Tests/ObjectIdFixture.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void DifferentObjectIdsAreEqual()
5959
Assert.False((b.Equals(a)));
6060

6161
Assert.False((a == b));
62-
(a != b).ShouldBeTrue();
62+
Assert.True((a != b));
6363
}
6464

6565
[Fact]
@@ -77,10 +77,10 @@ public void SimilarObjectIdsAreEqual()
7777
var a = new ObjectId(validSha1);
7878
var b = new ObjectId(validSha1);
7979

80-
(a.Equals(b)).ShouldBeTrue();
81-
(b.Equals(a)).ShouldBeTrue();
80+
Assert.True((a.Equals(b)));
81+
Assert.True((b.Equals(a)));
8282

83-
(a == b).ShouldBeTrue();
83+
Assert.True((a == b));
8484
Assert.False((a != b));
8585
}
8686

@@ -117,7 +117,7 @@ public void TryParse(string maybeSha, bool isValidSha)
117117

118118
parsedObjectId.ShouldNotBeNull();
119119
Assert.Equal(maybeSha, parsedObjectId.Sha);
120-
maybeSha.StartsWith(parsedObjectId.ToString(3)).ShouldBeTrue();
120+
Assert.True(maybeSha.StartsWith(parsedObjectId.ToString(3)));
121121
Assert.Equal(maybeSha, parsedObjectId.ToString(42));
122122
}
123123
}

LibGit2Sharp.Tests/ReferenceFixture.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public void DeletingAReferenceDecreasesTheRefsCount()
176176
const string refName = "refs/heads/test";
177177

178178
List<string> refs = repo.Refs.Select(r => r.CanonicalName).ToList();
179-
refs.Contains(refName).ShouldBeTrue();
179+
Assert.True(refs.Contains(refName));
180180

181181
repo.Refs.Delete(refName);
182182

@@ -348,11 +348,11 @@ public void CanUpdateHeadWithEitherAnOidOrACanonicalHeadReference()
348348
Branch test = repo.Branches["test"];
349349

350350
Reference direct = repo.Refs.UpdateTarget("HEAD", test.Tip.Sha);
351-
(direct is DirectReference).ShouldBeTrue();
351+
Assert.True((direct is DirectReference));
352352
Assert.Equal(repo.Refs["HEAD"], direct);
353353

354354
Reference symref = repo.Refs.UpdateTarget("HEAD", test.CanonicalName);
355-
(symref is SymbolicReference).ShouldBeTrue();
355+
Assert.True((symref is SymbolicReference));
356356
Assert.Equal(repo.Refs["HEAD"], symref);
357357
}
358358

@@ -485,13 +485,13 @@ public void MovingAReferenceDoesNotDecreaseTheRefsCount()
485485
const string newName = "refs/atic/tagtest";
486486

487487
List<string> refs = repo.Refs.Select(r => r.CanonicalName).ToList();
488-
refs.Contains(oldName).ShouldBeTrue();
488+
Assert.True(refs.Contains(oldName));
489489

490490
repo.Refs.Move(oldName, newName);
491491

492492
List<string> refs2 = repo.Refs.Select(r => r.CanonicalName).ToList();
493493
Assert.False(refs2.Contains(oldName));
494-
refs2.Contains(newName).ShouldBeTrue();
494+
Assert.True(refs2.Contains(newName));
495495

496496
Assert.Equal(refs2.Count, refs.Count);
497497
}

LibGit2Sharp.Tests/RepositoryFixture.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ public void CanCreateBareRepo()
1717
using (var repo = Repository.Init(scd.DirectoryPath, true))
1818
{
1919
string dir = repo.Info.Path;
20-
Path.IsPathRooted(dir).ShouldBeTrue();
21-
Directory.Exists(dir).ShouldBeTrue();
20+
Assert.True(Path.IsPathRooted(dir));
21+
Assert.True(Directory.Exists(dir));
2222
CheckGitConfigFile(dir);
2323

2424
Assert.Null(repo.Info.WorkingDirectory);
2525
Assert.Equal(scd.RootedDirectoryPath + Path.DirectorySeparatorChar, repo.Info.Path);
26-
repo.Info.IsBare.ShouldBeTrue();
26+
Assert.True(repo.Info.IsBare);
2727

2828
AssertInitializedRepository(repo);
2929
}
@@ -46,8 +46,8 @@ public void CanCreateStandardRepo()
4646
using (var repo = Repository.Init(scd.DirectoryPath))
4747
{
4848
string dir = repo.Info.Path;
49-
Path.IsPathRooted(dir).ShouldBeTrue();
50-
Directory.Exists(dir).ShouldBeTrue();
49+
Assert.True(Path.IsPathRooted(dir));
50+
Assert.True(Directory.Exists(dir));
5151
CheckGitConfigFile(dir);
5252

5353
repo.Info.WorkingDirectory.ShouldNotBeNull();
@@ -63,7 +63,7 @@ public void CanCreateStandardRepo()
6363
private static void CheckGitConfigFile(string dir)
6464
{
6565
string configFilePath = Path.Combine(dir, "config");
66-
File.Exists(configFilePath).ShouldBeTrue();
66+
Assert.True(File.Exists(configFilePath));
6767

6868
string contents = File.ReadAllText(configFilePath);
6969
contents.IndexOf("repositoryformatversion = 0", StringComparison.Ordinal).ShouldNotEqual(-1);
@@ -98,7 +98,7 @@ public void CreatingRepoWithBadParamsThrows()
9898
private static void AssertInitializedRepository(Repository repo)
9999
{
100100
repo.Info.Path.ShouldNotBeNull();
101-
repo.Info.IsEmpty.ShouldBeTrue();
101+
Assert.True(repo.Info.IsEmpty);
102102
Assert.False(repo.Info.IsHeadDetached);
103103

104104
Reference headRef = repo.Refs["HEAD"];
@@ -107,7 +107,7 @@ private static void AssertInitializedRepository(Repository repo)
107107
Assert.Null(headRef.ResolveToDirectReference());
108108

109109
repo.Head.ShouldNotBeNull();
110-
repo.Head.IsCurrentRepositoryHead.ShouldBeTrue();
110+
Assert.True(repo.Head.IsCurrentRepositoryHead);
111111
Assert.Equal(headRef.TargetIdentifier, repo.Head.CanonicalName);
112112
Assert.Null(repo.Head.Tip);
113113

@@ -161,7 +161,7 @@ public void CanOpenRepository()
161161
{
162162
repo.Info.Path.ShouldNotBeNull();
163163
Assert.Null(repo.Info.WorkingDirectory);
164-
repo.Info.IsBare.ShouldBeTrue();
164+
Assert.True(repo.Info.IsBare);
165165
Assert.False(repo.Info.IsEmpty);
166166
Assert.False(repo.Info.IsHeadDetached);
167167
}
@@ -231,7 +231,7 @@ public void CanLookupSameObjectTwiceAndTheyAreEqual()
231231
{
232232
GitObject commit = repo.Lookup(commitSha);
233233
GitObject commit2 = repo.Lookup(commitSha);
234-
commit.Equals(commit2).ShouldBeTrue();
234+
Assert.True(commit.Equals(commit2));
235235
Assert.Equal(commit2.GetHashCode(), commit.GetHashCode());
236236
}
237237
}

LibGit2Sharp.Tests/StatusFixture.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void CanRetrieveTheStatusOfTheWholeWorkingDirectory()
4242

4343
status.ShouldNotBeNull();
4444
Assert.Equal(6, status.Count());
45-
status.IsDirty.ShouldBeTrue();
45+
Assert.True(status.IsDirty);
4646

4747
Assert.Equal("new_untracked_file.txt", status.Untracked.Single());
4848
Assert.Equal("modified_unstaged_file.txt", status.Modified.Single());
@@ -60,7 +60,7 @@ public void CanRetrieveTheStatusOfTheWholeWorkingDirectory()
6060

6161
status2.ShouldNotBeNull();
6262
Assert.Equal(6, status2.Count());
63-
status2.IsDirty.ShouldBeTrue();
63+
Assert.True(status2.IsDirty);
6464

6565
Assert.Equal("new_untracked_file.txt", status2.Untracked.Single());
6666
Assert.Equal(new[] { file, "modified_unstaged_file.txt" }, status2.Modified);

0 commit comments

Comments
 (0)