diff --git a/LibGit2Sharp.Tests/BranchFixture.cs b/LibGit2Sharp.Tests/BranchFixture.cs index 736b0faec8..88247e256a 100644 --- a/LibGit2Sharp.Tests/BranchFixture.cs +++ b/LibGit2Sharp.Tests/BranchFixture.cs @@ -4,7 +4,6 @@ using System.Linq; using LibGit2Sharp.Tests.TestHelpers; using Xunit; -using Xunit.Extensions; namespace LibGit2Sharp.Tests { @@ -103,7 +102,7 @@ public void CanCreateAnUnbornBranch() public void CanCreateBranchUsingAbbreviatedSha() { string path = SandboxBareTestRepo(); - using (var repo = new Repository(path, new RepositoryOptions{ Identity = Constants.Identity })) + using (var repo = new Repository(path, new RepositoryOptions { Identity = Constants.Identity })) { EnableRefLog(repo); @@ -1001,7 +1000,7 @@ public void OnlyOneBranchIsTheHead() continue; } - Assert.True(false, string.Format("Both '{0}' and '{1}' appear to be Head.", head.CanonicalName, branch.CanonicalName)); + Assert.Fail(string.Format("Both '{0}' and '{1}' appear to be Head.", head.CanonicalName, branch.CanonicalName)); } Assert.NotNull(head); diff --git a/LibGit2Sharp.Tests/FilterFixture.cs b/LibGit2Sharp.Tests/FilterFixture.cs index 4de3540039..832ca0cad6 100644 --- a/LibGit2Sharp.Tests/FilterFixture.cs +++ b/LibGit2Sharp.Tests/FilterFixture.cs @@ -1,10 +1,9 @@ using System; using System.Collections.Generic; -using System.Linq; using System.IO; +using System.Threading.Tasks; using LibGit2Sharp.Tests.TestHelpers; using Xunit; -using System.Threading.Tasks; namespace LibGit2Sharp.Tests { @@ -174,7 +173,7 @@ public void CleanFilterWritesOutputToObjectTree() } [Fact] - public void CanHandleMultipleSmudgesConcurrently() + public async Task CanHandleMultipleSmudgesConcurrently() { const string decodedInput = "This is a substitution cipher"; const string encodedInput = "Guvf vf n fhofgvghgvba pvcure"; @@ -193,20 +192,18 @@ public void CanHandleMultipleSmudgesConcurrently() for (int i = 0; i < count; i++) { - tasks[i] = Task.Factory.StartNew(() => + tasks[i] = Task.Run(() => { string repoPath = InitNewRepository(); return CheckoutFileForSmudge(repoPath, branchName, encodedInput); }); } - Task.WaitAll(tasks); + var files = await Task.WhenAll(tasks); - foreach(var task in tasks) + foreach (var file in files) { - FileInfo expectedFile = task.Result; - - string readAllText = File.ReadAllText(expectedFile.FullName); + string readAllText = File.ReadAllText(file.FullName); Assert.Equal(decodedInput, readAllText); } } diff --git a/LibGit2Sharp.Tests/MetaFixture.cs b/LibGit2Sharp.Tests/MetaFixture.cs index eac08793da..5ff76e3079 100644 --- a/LibGit2Sharp.Tests/MetaFixture.cs +++ b/LibGit2Sharp.Tests/MetaFixture.cs @@ -112,7 +112,7 @@ public void TypesInLibGit2DecoratedWithDebuggerDisplayMustFollowTheStandardImplP if (typesWithDebuggerDisplayAndInvalidImplPattern.Any()) { - Assert.True(false, Environment.NewLine + BuildMissingDebuggerDisplayPropertyMessage(typesWithDebuggerDisplayAndInvalidImplPattern)); + Assert.Fail(Environment.NewLine + BuildMissingDebuggerDisplayPropertyMessage(typesWithDebuggerDisplayAndInvalidImplPattern)); } } @@ -167,7 +167,7 @@ public void TypesInLibGit2SharpMustBeExtensibleInATestingContext() if (nonTestableTypes.Any()) { - Assert.True(false, Environment.NewLine + BuildNonTestableTypesMessage(nonTestableTypes)); + Assert.Fail(Environment.NewLine + BuildNonTestableTypesMessage(nonTestableTypes)); } } @@ -287,7 +287,7 @@ public void GetEnumeratorMethodsInLibGit2SharpMustBeVirtualForTestability() method.DeclaringType, Environment.NewLine); } - Assert.True(false, Environment.NewLine + sb.ToString()); + Assert.Fail(Environment.NewLine + sb.ToString()); } } @@ -316,7 +316,7 @@ public void NoPublicTypesUnderLibGit2SharpCoreNamespace() type.FullName, coreNamespace, Environment.NewLine); } - Assert.True(false, Environment.NewLine + sb.ToString()); + Assert.Fail(Environment.NewLine + sb.ToString()); } } diff --git a/LibGit2Sharp.Tests/PushFixture.cs b/LibGit2Sharp.Tests/PushFixture.cs index fc6c0c42d4..824c1d8c01 100644 --- a/LibGit2Sharp.Tests/PushFixture.cs +++ b/LibGit2Sharp.Tests/PushFixture.cs @@ -12,8 +12,7 @@ public class PushFixture : BaseFixture { private void OnPushStatusError(PushStatusError pushStatusErrors) { - Assert.True(false, string.Format("Failed to update reference '{0}': {1}", - pushStatusErrors.Reference, pushStatusErrors.Message)); + Assert.Fail(string.Format("Failed to update reference '{0}': {1}", pushStatusErrors.Reference, pushStatusErrors.Message)); } private void AssertPush(Action push)