-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* prepare 4.2 * Fix warning and set beta,2 * Adding more logging * filters added handling explicits * small fixes * Code cleanup * beta.4 * Addind filter acceptance tests * update with more logs * Adding nunit.where tester * FIx warnings * Added more tests and added csproj base class to make it easier to make more * fix tests * fix SA warnings * Oppdatert pakker o.a. * Reanebled output of console message, introducing another ConsoleOut level, so one can go back. Fixes #934 * fixing linux errors * Add consoletests * COnsole and propertytests * naming fixed * fix * FIx namespaces * sa fix * sa fix * accentance tests, with parantheses issue * Fixing Issue #919 * fix braces * fix braces * Version to 4.2.0
- Loading branch information
1 parent
c499397
commit 0b118ec
Showing
47 changed files
with
986 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using NUnit.Framework; | ||
using NUnit.VisualStudio.TestAdapter.Tests.Acceptance.WorkspaceTools; | ||
|
||
namespace NUnit.VisualStudio.TestAdapter.Tests.Acceptance | ||
{ | ||
public sealed class ConsoleOutTests : CsProjAcceptanceTests | ||
{ | ||
protected override void AddTestsCs(IsolatedWorkspace workspace) | ||
{ | ||
workspace.AddFile("Issue774.cs", @" | ||
using System; | ||
using NUnit.Framework; | ||
namespace Issue774 | ||
{ | ||
public class ConsoleOutTest | ||
{ | ||
[Test] | ||
public void Test1() | ||
{ | ||
Console.WriteLine(); // Did not work pre-Issue774 fix | ||
Assert.Pass(); | ||
} | ||
[Test] | ||
public void Test2() | ||
{ | ||
Console.WriteLine(""Does work""); | ||
Assert.Pass(); | ||
} | ||
} | ||
}"); | ||
} | ||
|
||
protected override string Framework => Frameworks.NetCoreApp31; | ||
|
||
[Test, Platform("Win")] | ||
public void DotNetTest() | ||
{ | ||
var workspace = Build(); | ||
var results = workspace.DotNetTest("", true, true, TestContext.WriteLine); | ||
Verify(2, 2, results); | ||
} | ||
|
||
[Test, Platform("Win")] | ||
public void VsTest() | ||
{ | ||
var workspace = Build(); | ||
var results = workspace.VSTest($@"bin\Debug\{Framework}\Test.dll", VsTestFilter.NoFilter); | ||
Verify(2, 2, results); | ||
} | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
src/NUnit.TestAdapter.Tests.Acceptance/CsProjAcceptanceTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using NUnit.Framework; | ||
using NUnit.VisualStudio.TestAdapter.Tests.Acceptance.WorkspaceTools; | ||
|
||
namespace NUnit.VisualStudio.TestAdapter.Tests.Acceptance | ||
{ | ||
public abstract class CsProjAcceptanceTests : AcceptanceTests | ||
{ | ||
protected abstract void AddTestsCs(IsolatedWorkspace workspace); | ||
|
||
protected abstract string Framework { get; } | ||
protected const string NoFilter = ""; | ||
protected IsolatedWorkspace CreateTestWorkspace(string framework) | ||
{ | ||
var workspace = CreateWorkspace() | ||
.AddProject("Test.csproj", $@" | ||
<Project Sdk='Microsoft.NET.Sdk'> | ||
<PropertyGroup> | ||
<TargetFramework>{framework}</TargetFramework> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include='Microsoft.NET.Test.Sdk' Version='*' /> | ||
<PackageReference Include='NUnit' Version='*' /> | ||
<PackageReference Include='NUnit3TestAdapter' Version='{NuGetPackageVersion}' /> | ||
</ItemGroup> | ||
</Project>"); | ||
return workspace; | ||
} | ||
|
||
protected IsolatedWorkspace Build() | ||
{ | ||
var workspace = CreateTestWorkspace(Framework); | ||
AddTestsCs(workspace); | ||
workspace.MsBuild(restore: true); | ||
return workspace; | ||
} | ||
|
||
protected void Verify(int executed, int total, VSTestResult results) | ||
{ | ||
TestContext.WriteLine(" "); | ||
foreach (var error in results.RunErrors) | ||
TestContext.WriteLine(error); | ||
Assert.Multiple(() => | ||
{ | ||
Assert.That(results.Counters.Total, Is.EqualTo(total), | ||
$"Total tests counter did not match expectation\n{results.ProcessRunResult.StdOut}"); | ||
Assert.That(results.Counters.Executed, Is.EqualTo(executed), | ||
"Executed tests counter did not match expectation"); | ||
Assert.That(results.Counters.Passed, Is.EqualTo(executed), "Passed tests counter did not match expectation"); | ||
}); | ||
} | ||
} | ||
} |
Oops, something went wrong.