Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replace AssertExtensions.ShouldNotBeNull method by Assert.NotNull

  • Loading branch information...
commit d9c7e7ab91f81231d3f18742a35c37baefbe5389 1 parent e02f76b
@yorah yorah authored nulltoken committed
View
2  LibGit2Sharp.Tests/BlobFixture.cs
@@ -35,7 +35,7 @@ public void CanLookUpBlob()
using (var repo = new Repository(BareTestRepoPath))
{
var blob = repo.Lookup<Blob>("a8233120f6ad708f843d861ce2b7228ec4e3dec6");
- blob.ShouldNotBeNull();
+ Assert.NotNull(blob);
}
}
View
42 LibGit2Sharp.Tests/BranchFixture.cs
@@ -19,12 +19,12 @@ public void CanCreateBranch(string name)
using (var repo = new Repository(path.RepositoryPath))
{
Branch newBranch = repo.CreateBranch(name, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
- newBranch.ShouldNotBeNull();
+ Assert.NotNull(newBranch);
Assert.Equal(name, newBranch.Name);
Assert.Equal("refs/heads/" + name, newBranch.CanonicalName);
- newBranch.Tip.ShouldNotBeNull();
+ Assert.NotNull(newBranch.Tip);
Assert.Equal("be3563ae3f795b2b4353bcce3a527ad0a4f7f644", newBranch.Tip.Sha);
- repo.Branches.SingleOrDefault(p => p.Name == name).ShouldNotBeNull();
+ Assert.NotNull(repo.Branches.SingleOrDefault(p => p.Name == name));
repo.Branches.Delete(newBranch.Name);
}
@@ -51,13 +51,13 @@ public void CanCreateBranchFromImplicitHead()
{
const string name = "unit_test";
Branch newBranch = repo.CreateBranch(name);
- newBranch.ShouldNotBeNull();
+ Assert.NotNull(newBranch);
Assert.Equal(name, newBranch.Name);
Assert.Equal("refs/heads/" + name, newBranch.CanonicalName);
Assert.False(newBranch.IsCurrentRepositoryHead);
- newBranch.Tip.ShouldNotBeNull();
+ Assert.NotNull(newBranch.Tip);
Assert.Equal("4c062a6361ae6959e06292c1fa5e2822d9c96345", newBranch.Tip.Sha);
- repo.Branches.SingleOrDefault(p => p.Name == name).ShouldNotBeNull();
+ Assert.NotNull(repo.Branches.SingleOrDefault(p => p.Name == name));
}
}
@@ -69,7 +69,7 @@ public void CanCreateBranchFromExplicitHead()
{
const string name = "unit_test";
Branch newBranch = repo.CreateBranch(name, "HEAD");
- newBranch.ShouldNotBeNull();
+ Assert.NotNull(newBranch);
Assert.Equal("4c062a6361ae6959e06292c1fa5e2822d9c96345", newBranch.Tip.Sha);
}
}
@@ -83,7 +83,7 @@ public void CanCreateBranchFromCommit()
const string name = "unit_test";
var commit = repo.Lookup<Commit>("HEAD");
Branch newBranch = repo.CreateBranch(name, commit);
- newBranch.ShouldNotBeNull();
+ Assert.NotNull(newBranch);
Assert.Equal("4c062a6361ae6959e06292c1fa5e2822d9c96345", newBranch.Tip.Sha);
}
}
@@ -96,7 +96,7 @@ public void CreatingABranchFromATagPeelsToTheCommit()
{
const string name = "i-peel-tag";
Branch newBranch = repo.CreateBranch(name, "refs/tags/test");
- newBranch.ShouldNotBeNull();
+ Assert.NotNull(newBranch);
Assert.Equal("e90810b8df3e80c413d903f631643c716887138d", newBranch.Tip.Sha);
}
}
@@ -114,7 +114,7 @@ public void CreatingABranchTriggersTheCreationOfADirectReference()
Assert.Equal(commitId, newBranch.Tip.Id);
Reference reference = repo.Refs[newBranch.CanonicalName];
- reference.ShouldNotBeNull();
+ Assert.NotNull(reference);
Assert.IsType(typeof(DirectReference), reference);
}
}
@@ -221,11 +221,11 @@ public void CanLookupABranchByItsCanonicalName()
using (var repo = new Repository(BareTestRepoPath))
{
Branch branch = repo.Branches["refs/heads/br2"];
- branch.ShouldNotBeNull();
+ Assert.NotNull(branch);
Assert.Equal("br2", branch.Name);
Branch branch2 = repo.Branches["refs/heads/br2"];
- branch2.ShouldNotBeNull();
+ Assert.NotNull(branch2);
Assert.Equal("br2", branch2.Name);
Assert.Equal(branch, branch2);
@@ -239,7 +239,7 @@ public void CanLookupLocalBranch()
using (var repo = new Repository(BareTestRepoPath))
{
Branch master = repo.Branches["master"];
- master.ShouldNotBeNull();
+ Assert.NotNull(master);
Assert.False(master.IsRemote);
Assert.Equal("master", master.Name);
Assert.Equal("refs/heads/master", master.CanonicalName);
@@ -256,10 +256,10 @@ public void CanLookupABranchWhichNameIsMadeOfNon7BitsAsciiCharacters()
{
const string name = "Ångström";
Branch newBranch = repo.CreateBranch(name, "be3563a");
- newBranch.ShouldNotBeNull();
+ Assert.NotNull(newBranch);
Branch retrieved = repo.Branches["Ångström"];
- retrieved.ShouldNotBeNull();
+ Assert.NotNull(retrieved);
Assert.Equal(newBranch.Tip, retrieved.Tip);
}
}
@@ -346,7 +346,7 @@ public void CanCheckoutAnExistingBranch(string name)
Assert.True(master.IsCurrentRepositoryHead);
Branch branch = repo.Branches[name];
- branch.ShouldNotBeNull();
+ Assert.NotNull(branch);
Branch test = repo.Checkout(branch);
Assert.False(repo.Info.IsHeadDetached);
@@ -507,7 +507,7 @@ public void OnlyOneBranchIsTheHead()
Assert.True(false, string.Format("Both '{0}' and '{1}' appear to be Head.", head.CanonicalName, branch.CanonicalName));
}
- head.ShouldNotBeNull();
+ Assert.NotNull(head);
}
}
@@ -536,7 +536,7 @@ public void CanMoveABranch()
Assert.Equal("br3", newBranch.Name);
Assert.Null(repo.Branches["br2"]);
- repo.Branches["br3"].ShouldNotBeNull();
+ Assert.NotNull(repo.Branches["br3"]);
}
}
@@ -556,10 +556,10 @@ public void CanMoveABranchWhileOverwritingAnExistingOne()
using (var repo = new Repository(path.RepositoryPath))
{
Branch test = repo.Branches["test"];
- test.ShouldNotBeNull();
+ Assert.NotNull(test);
Branch br2 = repo.Branches["br2"];
- br2.ShouldNotBeNull();
+ Assert.NotNull(br2);
Branch newBranch = repo.Branches.Move("br2", "test", true);
Assert.Equal("test", newBranch.Name);
@@ -567,7 +567,7 @@ public void CanMoveABranchWhileOverwritingAnExistingOne()
Assert.Null(repo.Branches["br2"]);
Branch newTest = repo.Branches["test"];
- newTest.ShouldNotBeNull();
+ Assert.NotNull(newTest);
Assert.Equal(newBranch, newTest);
Assert.Equal(br2.Tip, newTest.Tip);
View
24 LibGit2Sharp.Tests/CommitFixture.cs
@@ -45,7 +45,7 @@ public void CanEnumerateCommits()
{
foreach (Commit commit in repo.Commits)
{
- commit.ShouldNotBeNull();
+ Assert.NotNull(commit);
count++;
}
}
@@ -84,7 +84,7 @@ public void CanEnumerateCommitsFromSha()
{
foreach (Commit commit in repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f" }))
{
- commit.ShouldNotBeNull();
+ Assert.NotNull(commit);
count++;
}
}
@@ -137,7 +137,7 @@ public void CanEnumerateCommitsWithReverseTimeSorting()
{
foreach (Commit commit in repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = GitSortOptions.Time | GitSortOptions.Reverse }))
{
- commit.ShouldNotBeNull();
+ Assert.NotNull(commit);
Assert.True(commit.Sha.StartsWith(reversedShas[count]));
count++;
}
@@ -153,7 +153,7 @@ public void CanEnumerateCommitsWithReverseTopoSorting()
List<Commit> commits = repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = GitSortOptions.Time | GitSortOptions.Reverse }).ToList();
foreach (Commit commit in commits)
{
- commit.ShouldNotBeNull();
+ Assert.NotNull(commit);
foreach (Commit p in commit.Parents)
{
Commit parent = commits.Single(x => x.Id == p.Id);
@@ -180,7 +180,7 @@ public void CanEnumerateCommitsWithTimeSorting()
{
foreach (Commit commit in repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = GitSortOptions.Time }))
{
- commit.ShouldNotBeNull();
+ Assert.NotNull(commit);
Assert.True(commit.Sha.StartsWith(expectedShas[count]));
count++;
}
@@ -196,7 +196,7 @@ public void CanEnumerateCommitsWithTopoSorting()
List<Commit> commits = repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = GitSortOptions.Topological }).ToList();
foreach (Commit commit in commits)
{
- commit.ShouldNotBeNull();
+ Assert.NotNull(commit);
foreach (Commit p in commit.Parents)
{
Commit parent = commits.Single(x => x.Id == p.Id);
@@ -366,7 +366,7 @@ public void CanReadCommitData()
using (var repo = new Repository(BareTestRepoPath))
{
GitObject obj = repo.Lookup(sha);
- obj.ShouldNotBeNull();
+ Assert.NotNull(obj);
Assert.Equal(typeof(Commit), obj.GetType());
var commit = (Commit)obj;
@@ -375,12 +375,12 @@ public void CanReadCommitData()
Assert.Equal("UTF-8", commit.Encoding);
Assert.Equal(sha, commit.Sha);
- commit.Author.ShouldNotBeNull();
+ Assert.NotNull(commit.Author);
Assert.Equal("Scott Chacon", commit.Author.Name);
Assert.Equal("schacon@gmail.com", commit.Author.Email);
Assert.Equal(1273360386, commit.Author.When.ToSecondsSinceEpoch());
- commit.Committer.ShouldNotBeNull();
+ Assert.NotNull(commit.Committer);
Assert.Equal("Scott Chacon", commit.Committer.Name);
Assert.Equal("schacon@gmail.com", commit.Committer.Email);
Assert.Equal(1273360386, commit.Committer.When.ToSecondsSinceEpoch());
@@ -410,7 +410,7 @@ public void CanDirectlyAccessABlobOfTheCommit()
var commit = repo.Lookup<Commit>("4c062a6");
var blob = commit["1/branch_file.txt"].Target as Blob;
- blob.ShouldNotBeNull();
+ Assert.NotNull(blob);
Assert.Equal("hi\n", blob.ContentAsUtf8());
}
@@ -424,7 +424,7 @@ public void CanDirectlyAccessATreeOfTheCommit()
var commit = repo.Lookup<Commit>("4c062a6");
var tree1 = commit["1"].Target as Tree;
- tree1.ShouldNotBeNull();
+ Assert.NotNull(tree1);
}
}
@@ -609,7 +609,7 @@ public void CanAmendACommitWithMoreThanOneParent()
using (var repo = new Repository(path.RepositoryPath))
{
var mergedCommit = repo.Lookup<Commit>("be3563a");
- mergedCommit.ShouldNotBeNull();
+ Assert.NotNull(mergedCommit);
Assert.Equal(2, mergedCommit.ParentsCount);
repo.Reset(ResetOptions.Soft, mergedCommit.Sha);
View
8 LibGit2Sharp.Tests/ConfigurationFixture.cs
@@ -74,7 +74,7 @@ public void CanGetGlobalStringValue()
{
InconclusiveIf(() => !repo.Config.HasGlobalConfig, "No Git global configuration available");
- repo.Config.Get<string>("user.name", null).ShouldNotBeNull();
+ Assert.NotNull(repo.Config.Get<string>("user.name", null));
}
}
@@ -84,7 +84,7 @@ public void CanGetGlobalStringValueWithoutRepo()
using (var config = new Configuration())
{
InconclusiveIf(() => !config.HasGlobalConfig, "No Git global configuration available");
- config.Get<string>("user.name", null).ShouldNotBeNull();
+ Assert.NotNull(config.Get<string>("user.name", null));
}
}
@@ -148,7 +148,7 @@ public void CanSetGlobalStringValue()
InconclusiveIf(() => !repo.Config.HasGlobalConfig, "No Git global configuration available");
var existing = repo.Config.Get<string>("user.name", null);
- existing.ShouldNotBeNull();
+ Assert.NotNull(existing);
try
{
@@ -171,7 +171,7 @@ public void CanSetGlobalStringValueWithoutRepo()
InconclusiveIf(() => !config.HasGlobalConfig, "No Git global configuration available");
var existing = config.Get<string>("user.name", null);
- existing.ShouldNotBeNull();
+ Assert.NotNull(existing);
try
{
View
14 LibGit2Sharp.Tests/IndexFixture.cs
@@ -152,7 +152,7 @@ public void CanStageTheRemovalOfAStagedFile()
{
int count = repo.Index.Count;
const string filename = "new_tracked_file.txt";
- repo.Index[filename].ShouldNotBeNull();
+ Assert.NotNull(repo.Index[filename]);
Assert.Equal(FileStatus.Added, repo.Index.RetrieveStatus(filename));
@@ -208,7 +208,7 @@ public void CanStageANewFileInAPersistentManner()
Assert.Null(repo.Index[filename]);
repo.Index.Stage(filename);
- repo.Index[filename].ShouldNotBeNull();
+ Assert.NotNull(repo.Index[filename]);
Assert.Equal(FileStatus.Added, repo.Index.RetrieveStatus(filename));
Assert.Equal(FileStatus.Added, repo.Index[filename].State);
}
@@ -216,7 +216,7 @@ public void CanStageANewFileInAPersistentManner()
using (var repo = new Repository(path.RepositoryPath))
{
const string filename = "unit_test.txt";
- repo.Index[filename].ShouldNotBeNull();
+ Assert.NotNull(repo.Index[filename]);
Assert.Equal(FileStatus.Added, repo.Index.RetrieveStatus(filename));
Assert.Equal(FileStatus.Added, repo.Index[filename].State);
}
@@ -237,7 +237,7 @@ public void CanStageANewFileWithAFullPath()
repo.Index.Stage(fullPath);
Assert.Equal(count + 1, repo.Index.Count);
- repo.Index[filename].ShouldNotBeNull();
+ Assert.NotNull(repo.Index[filename]);
}
}
@@ -259,7 +259,7 @@ public void CanStageANewFileWithARelativePathContainingNativeDirectorySeparatorC
Assert.Equal(count + 1, repo.Index.Count);
const string posixifiedPath = "Project/a_file.txt";
- repo.Index[posixifiedPath].ShouldNotBeNull();
+ Assert.NotNull(repo.Index[posixifiedPath]);
Assert.Equal(file, repo.Index[posixifiedPath].Path);
}
}
@@ -541,8 +541,8 @@ public void PathsOfIndexEntriesAreExpressedInNativeFormat()
IndexEntry ie = index[relFilePath];
// Make sure the IndexEntry has been found
- ie.ShouldNotBeNull();
-
+ Assert.NotNull(ie);
+
// Make sure that the (native) relFilePath and ie.Path are equal
Assert.Equal(relFilePath, ie.Path);
}
View
2  LibGit2Sharp.Tests/ObjectIdFixture.cs
@@ -115,7 +115,7 @@ public void TryParse(string maybeSha, bool isValidSha)
return;
}
- parsedObjectId.ShouldNotBeNull();
+ Assert.NotNull(parsedObjectId);
Assert.Equal(maybeSha, parsedObjectId.Sha);
Assert.True(maybeSha.StartsWith(parsedObjectId.ToString(3)));
Assert.Equal(maybeSha, parsedObjectId.ToString(42));
View
48 LibGit2Sharp.Tests/ReferenceFixture.cs
@@ -24,12 +24,12 @@ public void CanCreateADirectReference()
using (var repo = new Repository(path.RepositoryPath))
{
var newRef = (DirectReference)repo.Refs.Create(name, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
- newRef.ShouldNotBeNull();
+ Assert.NotNull(newRef);
Assert.Equal(name, newRef.CanonicalName);
- newRef.Target.ShouldNotBeNull();
+ Assert.NotNull(newRef.Target);
Assert.Equal("be3563ae3f795b2b4353bcce3a527ad0a4f7f644", newRef.Target.Sha);
Assert.Equal(newRef.Target.Sha, newRef.TargetIdentifier);
- repo.Refs[name].ShouldNotBeNull();
+ Assert.NotNull(repo.Refs[name]);
}
}
@@ -43,12 +43,12 @@ public void CanCreateASymbolicReference()
using (var repo = new Repository(path.RepositoryPath))
{
var newRef = (SymbolicReference)repo.Refs.Create(name, target);
- newRef.ShouldNotBeNull();
+ Assert.NotNull(newRef);
Assert.Equal(name, newRef.CanonicalName);
Assert.Equal(target, newRef.Target.CanonicalName);
Assert.Equal(newRef.Target.CanonicalName, newRef.TargetIdentifier);
Assert.Equal("4c062a6361ae6959e06292c1fa5e2822d9c96345", newRef.ResolveToDirectReference().Target.Sha);
- repo.Refs[name].ShouldNotBeNull();
+ Assert.NotNull(repo.Refs[name]);
}
}
@@ -82,9 +82,9 @@ public void CanCreateAndOverwriteADirectReference()
using (var repo = new Repository(path.RepositoryPath))
{
var newRef = (DirectReference)repo.Refs.Create(name, target, true);
- newRef.ShouldNotBeNull();
+ Assert.NotNull(newRef);
Assert.Equal(name, newRef.CanonicalName);
- newRef.Target.ShouldNotBeNull();
+ Assert.NotNull(newRef.Target);
Assert.Equal(target, newRef.Target.Sha);
Assert.Equal(target, ((DirectReference)repo.Refs[name]).Target.Sha);
}
@@ -100,9 +100,9 @@ public void CanCreateAndOverwriteASymbolicReference()
using (var repo = new Repository(path.RepositoryPath))
{
var newRef = (SymbolicReference)repo.Refs.Create(name, target, true);
- newRef.ShouldNotBeNull();
+ Assert.NotNull(newRef);
Assert.Equal(name, newRef.CanonicalName);
- newRef.Target.ShouldNotBeNull();
+ Assert.NotNull(newRef.Target);
Assert.Equal("a4a7dce85cf63874e984719f4fdd239f5145052f", newRef.ResolveToDirectReference().Target.Sha);
Assert.Equal(target, ((SymbolicReference)repo.Refs["HEAD"]).Target.CanonicalName);
}
@@ -225,16 +225,16 @@ public void CanResolveHeadByName()
using (var repo = new Repository(BareTestRepoPath))
{
var head = (SymbolicReference)repo.Refs["HEAD"];
- head.ShouldNotBeNull();
+ Assert.NotNull(head);
Assert.Equal("HEAD", head.CanonicalName);
- head.Target.ShouldNotBeNull();
+ Assert.NotNull(head.Target);
Assert.Equal("refs/heads/master", head.Target.CanonicalName);
Assert.Equal("4c062a6361ae6959e06292c1fa5e2822d9c96345", head.ResolveToDirectReference().Target.Sha);
Assert.IsType<Commit>(((DirectReference)head.Target).Target);
Branch head2 = repo.Head;
Assert.Equal("refs/heads/master", head2.CanonicalName);
- head2.Tip.ShouldNotBeNull();
+ Assert.NotNull(head2.Tip);
Assert.Equal(head.ResolveToDirectReference().Target, head2.Tip);
}
@@ -246,9 +246,9 @@ public void CanResolveReferenceToALightweightTag()
using (var repo = new Repository(BareTestRepoPath))
{
var lwTag = (DirectReference)repo.Refs["refs/tags/lw"];
- lwTag.ShouldNotBeNull();
+ Assert.NotNull(lwTag);
Assert.Equal("refs/tags/lw", lwTag.CanonicalName);
- lwTag.Target.ShouldNotBeNull();
+ Assert.NotNull(lwTag.Target);
Assert.Equal("e90810b8df3e80c413d903f631643c716887138d", lwTag.Target.Sha);
Assert.IsType<Commit>(lwTag.Target);
}
@@ -260,9 +260,9 @@ public void CanResolveReferenceToAnAnnotatedTag()
using (var repo = new Repository(BareTestRepoPath))
{
var annTag = (DirectReference)repo.Refs["refs/tags/test"];
- annTag.ShouldNotBeNull();
+ Assert.NotNull(annTag);
Assert.Equal("refs/tags/test", annTag.CanonicalName);
- annTag.Target.ShouldNotBeNull();
+ Assert.NotNull(annTag.Target);
Assert.Equal("b25fa35b38051e4ae45d4222e795f9df2e43f1d1", annTag.Target.Sha);
Assert.IsType<TagAnnotation>(annTag.Target);
}
@@ -274,9 +274,9 @@ public void CanResolveRefsByName()
using (var repo = new Repository(BareTestRepoPath))
{
var master = (DirectReference)repo.Refs["refs/heads/master"];
- master.ShouldNotBeNull();
+ Assert.NotNull(master);
Assert.Equal("refs/heads/master", master.CanonicalName);
- master.Target.ShouldNotBeNull();
+ Assert.NotNull(master.Target);
Assert.Equal("4c062a6361ae6959e06292c1fa5e2822d9c96345", master.Target.Sha);
Assert.IsType<Commit>(master.Target);
}
@@ -328,7 +328,7 @@ public void CanUpdateTargetOnSymbolicReference()
using (var repo = new Repository(path.RepositoryPath))
{
var newRef = (SymbolicReference)repo.Refs.Create(name, "refs/heads/master");
- newRef.ShouldNotBeNull();
+ Assert.NotNull(newRef);
repo.Refs.UpdateTarget(newRef.CanonicalName, "refs/heads/test");
@@ -366,7 +366,7 @@ public void UpdatingADirectRefWithSymbolFails()
using (var repo = new Repository(path.RepositoryPath))
{
var newRef = (SymbolicReference)repo.Refs.Create(name, "refs/heads/master");
- newRef.ShouldNotBeNull();
+ Assert.NotNull(newRef);
Assert.Throws<ArgumentException>(
() => repo.Refs.UpdateTarget(newRef.CanonicalName, repo.Refs["refs/heads/test"].ResolveToDirectReference().Target.Sha));
@@ -406,7 +406,7 @@ public void CanMoveAReferenceToADeeperReferenceHierarchy()
const string newName = "refs/tags/test/deep";
Reference moved = repo.Refs.Move("refs/tags/test", newName);
- moved.ShouldNotBeNull();
+ Assert.NotNull(moved);
Assert.Equal(newName, moved.CanonicalName);
}
}
@@ -422,7 +422,7 @@ public void CanMoveAReferenceToAUpperReferenceHierarchy()
repo.Refs.Create(oldName, repo.Head.CanonicalName);
Reference moved = repo.Refs.Move(oldName, newName);
- moved.ShouldNotBeNull();
+ Assert.NotNull(moved);
Assert.Equal(newName, moved.CanonicalName);
}
}
@@ -436,7 +436,7 @@ public void CanMoveAReferenceToADifferentReferenceHierarchy()
const string newName = "refs/atic/tagtest";
Reference moved = repo.Refs.Move("refs/tags/test", newName);
- moved.ShouldNotBeNull();
+ Assert.NotNull(moved);
Assert.Equal(newName, moved.CanonicalName);
}
}
@@ -462,7 +462,7 @@ public void CanMoveAndOverWriteAExistingReference()
Reference moved = repo.Refs.Move(oldName, newName, true);
Assert.Null(repo.Refs[oldName]);
- repo.Refs[moved.CanonicalName].ShouldNotBeNull();
+ Assert.NotNull(repo.Refs[moved.CanonicalName]);
}
}
View
8 LibGit2Sharp.Tests/RemoteFixture.cs
@@ -11,7 +11,7 @@ public void CanGetRemoteOrigin()
using (var repo = new Repository(StandardTestRepoPath))
{
Remote origin = repo.Remotes["origin"];
- origin.ShouldNotBeNull();
+ Assert.NotNull(origin);
Assert.Equal("origin", origin.Name);
Assert.Equal("c:/GitHub/libgit2sharp/Resources/testrepo.git", origin.Url);
}
@@ -35,7 +35,7 @@ public void CanEnumerateTheRemotes()
foreach (Remote remote in repo.Remotes)
{
- remote.ShouldNotBeNull();
+ Assert.NotNull(remote);
count++;
}
@@ -51,7 +51,7 @@ public void CanCheckEqualityOfRemote()
using (var repo = new Repository(path.RepositoryPath))
{
Remote oneOrigin = repo.Remotes["origin"];
- oneOrigin.ShouldNotBeNull();
+ Assert.NotNull(oneOrigin);
Remote otherOrigin = repo.Remotes["origin"];
Assert.Equal(oneOrigin, otherOrigin);
@@ -59,7 +59,7 @@ public void CanCheckEqualityOfRemote()
Remote createdRemote = repo.Remotes.Create("origin2", oneOrigin.Url);
Remote loadedRemote = repo.Remotes["origin2"];
- loadedRemote.ShouldNotBeNull();
+ Assert.NotNull(loadedRemote);
Assert.Equal(createdRemote, loadedRemote);
loadedRemote.ShouldNotEqual(oneOrigin);
View
36 LibGit2Sharp.Tests/RepositoryFixture.cs
@@ -50,7 +50,7 @@ public void CanCreateStandardRepo()
Assert.True(Directory.Exists(dir));
CheckGitConfigFile(dir);
- repo.Info.WorkingDirectory.ShouldNotBeNull();
+ Assert.NotNull(repo.Info.WorkingDirectory);
Assert.Equal(Path.Combine(scd.RootedDirectoryPath, ".git" + Path.DirectorySeparatorChar), repo.Info.Path);
Assert.False(repo.Info.IsBare);
@@ -97,16 +97,16 @@ public void CreatingRepoWithBadParamsThrows()
private static void AssertInitializedRepository(Repository repo)
{
- repo.Info.Path.ShouldNotBeNull();
+ Assert.NotNull(repo.Info.Path);
Assert.True(repo.Info.IsEmpty);
Assert.False(repo.Info.IsHeadDetached);
Reference headRef = repo.Refs["HEAD"];
- headRef.ShouldNotBeNull();
+ Assert.NotNull(headRef);
Assert.Equal("refs/heads/master", headRef.TargetIdentifier);
Assert.Null(headRef.ResolveToDirectReference());
- repo.Head.ShouldNotBeNull();
+ Assert.NotNull(repo.Head);
Assert.True(repo.Head.IsCurrentRepositoryHead);
Assert.Equal(headRef.TargetIdentifier, repo.Head.CanonicalName);
Assert.Null(repo.Head.Tip);
@@ -129,7 +129,7 @@ public void CanOpenBareRepositoryThroughAFullPathToTheGitDir()
string path = Path.GetFullPath(BareTestRepoPath);
using (var repo = new Repository(path))
{
- repo.ShouldNotBeNull();
+ Assert.NotNull(repo);
Assert.Null(repo.Info.WorkingDirectory);
}
}
@@ -139,8 +139,8 @@ public void CanOpenStandardRepositoryThroughAWorkingDirPath()
{
using (var repo = new Repository(StandardTestRepoWorkingDirPath))
{
- repo.ShouldNotBeNull();
- repo.Info.WorkingDirectory.ShouldNotBeNull();
+ Assert.NotNull(repo);
+ Assert.NotNull(repo.Info.WorkingDirectory);
}
}
@@ -149,8 +149,8 @@ public void OpeningStandardRepositoryThroughTheGitDirGuessesTheWorkingDirPath()
{
using (var repo = new Repository(StandardTestRepoPath))
{
- repo.ShouldNotBeNull();
- repo.Info.WorkingDirectory.ShouldNotBeNull();
+ Assert.NotNull(repo);
+ Assert.NotNull(repo.Info.WorkingDirectory);
}
}
@@ -159,7 +159,7 @@ public void CanOpenRepository()
{
using (var repo = new Repository(BareTestRepoPath))
{
- repo.Info.Path.ShouldNotBeNull();
+ Assert.NotNull(repo.Info.Path);
Assert.Null(repo.Info.WorkingDirectory);
Assert.True(repo.Info.IsBare);
Assert.False(repo.Info.IsEmpty);
@@ -186,7 +186,7 @@ public void CanLookupACommitByTheNameOfABranch()
using (var repo = new Repository(BareTestRepoPath))
{
GitObject gitObject = repo.Lookup("refs/heads/master");
- gitObject.ShouldNotBeNull();
+ Assert.NotNull(gitObject);
Assert.IsType<Commit>(gitObject);
}
}
@@ -197,7 +197,7 @@ public void CanLookupACommitByTheNameOfALightweightTag()
using (var repo = new Repository(BareTestRepoPath))
{
GitObject gitObject = repo.Lookup("refs/tags/lw");
- gitObject.ShouldNotBeNull();
+ Assert.NotNull(gitObject);
Assert.IsType<Commit>(gitObject);
}
}
@@ -208,7 +208,7 @@ public void CanLookupATagAnnotationByTheNameOfAnAnnotatedTag()
using (var repo = new Repository(BareTestRepoPath))
{
GitObject gitObject = repo.Lookup("refs/tags/e90810b");
- gitObject.ShouldNotBeNull();
+ Assert.NotNull(gitObject);
Assert.IsType<TagAnnotation>(gitObject);
}
}
@@ -218,9 +218,9 @@ public void CanLookupObjects()
{
using (var repo = new Repository(BareTestRepoPath))
{
- repo.Lookup(commitSha).ShouldNotBeNull();
- repo.Lookup<Commit>(commitSha).ShouldNotBeNull();
- repo.Lookup<GitObject>(commitSha).ShouldNotBeNull();
+ Assert.NotNull(repo.Lookup(commitSha));
+ Assert.NotNull(repo.Lookup<Commit>(commitSha));
+ Assert.NotNull(repo.Lookup<GitObject>(commitSha));
}
}
@@ -251,8 +251,8 @@ public void LookupObjectByWrongTypeReturnsNull()
{
using (var repo = new Repository(BareTestRepoPath))
{
- repo.Lookup(commitSha).ShouldNotBeNull();
- repo.Lookup<Commit>(commitSha).ShouldNotBeNull();
+ Assert.NotNull(repo.Lookup(commitSha));
+ Assert.NotNull(repo.Lookup<Commit>(commitSha));
Assert.Null(repo.Lookup<TagAnnotation>(commitSha));
}
}
View
6 LibGit2Sharp.Tests/StatusFixture.cs
@@ -40,7 +40,7 @@ public void CanRetrieveTheStatusOfTheWholeWorkingDirectory()
IndexEntry indexEntry = repo.Index[file];
Assert.Equal(FileStatus.Staged, indexEntry.State);
- status.ShouldNotBeNull();
+ Assert.NotNull(status);
Assert.Equal(6, status.Count());
Assert.True(status.IsDirty);
@@ -58,7 +58,7 @@ public void CanRetrieveTheStatusOfTheWholeWorkingDirectory()
RepositoryStatus status2 = repo.Index.RetrieveStatus();
- status2.ShouldNotBeNull();
+ Assert.NotNull(status2);
Assert.Equal(6, status2.Count());
Assert.True(status2.IsDirty);
@@ -79,7 +79,7 @@ public void CanRetrieveTheStatusOfANewRepository()
using (Repository repo = Repository.Init(scd.DirectoryPath))
{
RepositoryStatus status = repo.Index.RetrieveStatus();
- status.ShouldNotBeNull();
+ Assert.NotNull(status);
Assert.Equal(0, status.Count());
Assert.False(status.IsDirty);
View
40 LibGit2Sharp.Tests/TagFixture.cs
@@ -24,7 +24,7 @@ public void CanCreateALightWeightTagFromSha()
using (var repo = new Repository(path.RepositoryPath))
{
Tag newTag = repo.Tags.Create("i_am_lightweight", commitE90810BSha);
- newTag.ShouldNotBeNull();
+ Assert.NotNull(newTag);
Assert.False(newTag.IsAnnotated);
}
}
@@ -36,7 +36,7 @@ public void CanCreateALightWeightTagFromAbbreviatedSha()
using (var repo = new Repository(path.RepositoryPath))
{
Tag newTag = repo.Tags.Create("i_am_lightweight", commitE90810BSha.Substring(0, 17));
- newTag.ShouldNotBeNull();
+ Assert.NotNull(newTag);
Assert.False(newTag.IsAnnotated);
}
}
@@ -49,7 +49,7 @@ public void CanCreateALightweightTagFromABranchName()
{
Tag newTag = repo.Tags.Create("i_am_lightweight", "refs/heads/master");
Assert.False(newTag.IsAnnotated);
- newTag.ShouldNotBeNull();
+ Assert.NotNull(newTag);
}
}
@@ -60,7 +60,7 @@ public void CanCreateAndOverwriteALightweightTag()
using (var repo = new Repository(path.RepositoryPath))
{
Tag newTag = repo.Tags.Create("e90810b", commitE90810BSha, true);
- newTag.ShouldNotBeNull();
+ Assert.NotNull(newTag);
Assert.False(newTag.IsAnnotated);
}
}
@@ -73,14 +73,14 @@ public void CanCreateATagWithNameContainingASlash()
{
const string lwTagName = "i/am/deep";
Tag lwTag = repo.Tags.Create(lwTagName, commitE90810BSha);
- lwTag.ShouldNotBeNull();
+ Assert.NotNull(lwTag);
Assert.False(lwTag.IsAnnotated);
Assert.Equal(commitE90810BSha, lwTag.Target.Sha);
Assert.Equal(lwTagName, lwTag.Name);
const string anTagName = lwTagName + "_as_well";
Tag anTag = repo.Tags.Create(anTagName, commitE90810BSha, signatureNtk, "a nice message");
- anTag.ShouldNotBeNull();
+ Assert.NotNull(anTag);
Assert.True(anTag.IsAnnotated);
Assert.Equal(commitE90810BSha, anTag.Target.Sha);
Assert.Equal(anTag.Target, anTag.Annotation.Target);
@@ -108,7 +108,7 @@ public void CanCreateAnAnnotatedTagFromABranchName()
{
Tag newTag = repo.Tags.Create("unit_test", "refs/heads/master", signatureTim, "a new tag");
Assert.True(newTag.IsAnnotated);
- newTag.ShouldNotBeNull();
+ Assert.NotNull(newTag);
}
}
@@ -119,7 +119,7 @@ public void CanCreateAnAnnotatedTagFromSha()
using (var repo = new Repository(path.RepositoryPath))
{
Tag newTag = repo.Tags.Create("unit_test", tagTestSha, signatureTim, "a new tag");
- newTag.ShouldNotBeNull();
+ Assert.NotNull(newTag);
Assert.True(newTag.IsAnnotated);
}
}
@@ -132,7 +132,7 @@ public void CanCreateAnAnnotatedTagWithAnEmptyMessage()
using (var repo = new Repository(path.RepositoryPath))
{
Tag newTag = repo.ApplyTag("empty-annotated-tag", signatureNtk, string.Empty);
- newTag.ShouldNotBeNull();
+ Assert.NotNull(newTag);
Assert.True(newTag.IsAnnotated);
Assert.Equal(string.Empty, newTag.Annotation.Message);
}
@@ -145,7 +145,7 @@ public void CanCreateAndOverwriteAnAnnotatedTag()
using (var repo = new Repository(path.RepositoryPath))
{
Tag newTag = repo.Tags.Create("e90810b", tagTestSha, signatureTim, "a new tag", true);
- newTag.ShouldNotBeNull();
+ Assert.NotNull(newTag);
Assert.True(newTag.IsAnnotated);
}
}
@@ -228,7 +228,7 @@ public void CanCreateATagForImplicitHead()
using (var repo = new Repository(path.RepositoryPath))
{
Tag tag = repo.ApplyTag("mytag");
- tag.ShouldNotBeNull();
+ Assert.NotNull(tag);
Assert.Equal(repo.Head.Tip.Id, tag.Target.Id);
@@ -272,7 +272,7 @@ public void CanCreateATagUsingHead()
using (var repo = new Repository(path.RepositoryPath))
{
Tag tag = repo.ApplyTag("mytag", "HEAD");
- tag.ShouldNotBeNull();
+ Assert.NotNull(tag);
Assert.Equal(repo.Head.Tip.Id, tag.Target.Id);
@@ -291,7 +291,7 @@ public void CanCreateATagPointingToATree()
Tree tree = headCommit.Tree;
Tag tag = repo.ApplyTag("tree-tag", tree.Sha);
- tag.ShouldNotBeNull();
+ Assert.NotNull(tag);
Assert.False(tag.IsAnnotated);
Assert.Equal(tree.Id, tag.Target.Id);
@@ -310,7 +310,7 @@ public void CanCreateATagPointingToABlob()
Blob blob = headCommit.Tree.Blobs.First();
Tag tag = repo.ApplyTag("blob-tag", blob.Sha);
- tag.ShouldNotBeNull();
+ Assert.NotNull(tag);
Assert.False(tag.IsAnnotated);
Assert.Equal(blob.Id, tag.Target.Id);
@@ -329,7 +329,7 @@ public void CreatingALightweightTagPointingToATagAnnotationGeneratesAnAnnotatedT
TagAnnotation annotation = annotatedTag.Annotation;
Tag tag = repo.ApplyTag("lightweight-tag", annotation.Sha);
- tag.ShouldNotBeNull();
+ Assert.NotNull(tag);
Assert.True(tag.IsAnnotated);
Assert.Equal(annotation.Target.Id, tag.Target.Id);
Assert.Equal(annotation, tag.Annotation);
@@ -349,7 +349,7 @@ public void CanCreateAnAnnotatedTagPointingToATagAnnotation()
TagAnnotation annotation = annotatedTag.Annotation;
Tag tag = repo.ApplyTag("annotatedtag-tag", annotation.Sha, signatureNtk, "A new annotation");
- tag.ShouldNotBeNull();
+ Assert.NotNull(tag);
Assert.True(tag.IsAnnotated);
Assert.Equal(annotation.Id, tag.Annotation.Target.Id);
tag.Annotation.ShouldNotEqual(annotation);
@@ -567,7 +567,7 @@ public void CanLookupALightweightTag()
using (var repo = new Repository(BareTestRepoPath))
{
Tag tag = repo.Tags["lw"];
- tag.ShouldNotBeNull();
+ Assert.NotNull(tag);
Assert.Equal("lw", tag.Name);
Assert.Equal(commitE90810BSha, tag.Target.Sha);
@@ -582,11 +582,11 @@ public void CanLookupATagByItsCanonicalName()
using (var repo = new Repository(BareTestRepoPath))
{
Tag tag = repo.Tags["refs/tags/lw"];
- tag.ShouldNotBeNull();
+ Assert.NotNull(tag);
Assert.Equal("lw", tag.Name);
Tag tag2 = repo.Tags["refs/tags/lw"];
- tag2.ShouldNotBeNull();
+ Assert.NotNull(tag2);
Assert.Equal("lw", tag2.Name);
Assert.Equal(tag, tag2);
@@ -600,7 +600,7 @@ public void CanLookupAnAnnotatedTag()
using (var repo = new Repository(BareTestRepoPath))
{
Tag tag = repo.Tags["e90810b"];
- tag.ShouldNotBeNull();
+ Assert.NotNull(tag);
Assert.Equal("e90810b", tag.Name);
Assert.Equal(commitE90810BSha, tag.Target.Sha);
View
5 LibGit2Sharp.Tests/TestHelpers/AssertExtensions.cs
@@ -14,11 +14,6 @@ public static void ShouldBeAboutEqualTo(this DateTimeOffset expected, DateTimeOf
Assert.Equal(expected.Second, current.Second);
}
- public static void ShouldNotBeNull(this object currentObject)
- {
- Assert.NotNull(currentObject);
- }
-
public static void ShouldNotEqual(this object compareFrom, object compareTo)
{
Assert.NotEqual(compareTo, compareFrom);
View
10 LibGit2Sharp.Tests/TreeFixture.cs
@@ -31,7 +31,7 @@ public void CanConvertEntryToBlob()
TreeEntry treeEntry = tree["README"];
var blob = treeEntry.Target as Blob;
- blob.ShouldNotBeNull();
+ Assert.NotNull(blob);
}
}
@@ -44,7 +44,7 @@ public void CanConvertEntryToTree()
TreeEntry treeEntry = tree["1"];
var subtree = treeEntry.Target as Tree;
- subtree.ShouldNotBeNull();
+ Assert.NotNull(subtree);
}
}
@@ -129,7 +129,7 @@ public void CanReadTheTreeData()
using (var repo = new Repository(BareTestRepoPath))
{
var tree = repo.Lookup<Tree>(sha);
- tree.ShouldNotBeNull();
+ Assert.NotNull(tree);
}
}
@@ -139,7 +139,7 @@ public void TreeDataIsPresent()
using (var repo = new Repository(BareTestRepoPath))
{
GitObject tree = repo.Lookup(sha);
- tree.ShouldNotBeNull();
+ Assert.NotNull(tree);
}
}
@@ -162,7 +162,7 @@ public void CanRetrieveTreeEntryPath()
// A tree entry is now fetched through a relative path to the
// tree but exposes a complete path through its Path property
var subTree = treeTreeEntry.Target as Tree;
- subTree.ShouldNotBeNull();
+ Assert.NotNull(subTree);
TreeEntry anInstance = subTree["branch_file.txt"];
anInstance.Path.ShouldNotEqual("branch_file.txt");
Please sign in to comment.
Something went wrong with that request. Please try again.