-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from ricaun-io/develop
Version 1.4.0 - Support `TestCaseSourceAttribute`
- Loading branch information
Showing
20 changed files
with
456 additions
and
212 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<Version>1.4.0</Version> | ||
</PropertyGroup> | ||
</Project> |
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,19 @@ | ||
using NUnit.Framework; | ||
|
||
namespace SampleTest.Tests | ||
{ | ||
internal class InternalTests | ||
{ | ||
[Test] | ||
public void PublicTest() { } | ||
|
||
#if DEBUG | ||
// NUnit throw 'Method is not public' | ||
[Test] | ||
internal void InternalTest() { } | ||
|
||
[Test] | ||
private void PrivateTest() { } | ||
#endif | ||
} | ||
} |
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,77 @@ | ||
using NUnit.Framework; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
|
||
namespace SampleTest.Tests | ||
{ | ||
public class TestsCaseSource | ||
{ | ||
|
||
public static int[] CasesSource = new[] { 1, 2, 3 }; | ||
[TestCaseSource(nameof(CasesSource))] | ||
public void CasesSourceTest(int i) | ||
{ | ||
Assert.True(i > 0); | ||
} | ||
|
||
|
||
static IEnumerable<int> CasesSourceMethod() | ||
{ | ||
yield return 1; | ||
yield return 2; | ||
yield return 3; | ||
} | ||
[TestCaseSource(nameof(CasesSourceMethod))] | ||
public void CasesSourceMethodTest(int i) | ||
{ | ||
Assert.True(i > 0); | ||
} | ||
|
||
static IEnumerable<int> CasesSourceMethodWithParameters(int start, int count) | ||
{ | ||
for (int i = 0; i < count; i++) | ||
{ | ||
yield return start + i; | ||
} | ||
} | ||
|
||
[TestCaseSource(nameof(CasesSourceMethodWithParameters), new object[] { 1, 4 })] | ||
public void CasesSourceMethodWithParametersTest(int i) | ||
{ | ||
Assert.True(i > 0); | ||
} | ||
|
||
public class AnotherClass | ||
{ | ||
public static object[] CasesSource = | ||
{ | ||
new object[] { 1, 2, 3 }, | ||
new object[] { 2, 3, 4 }, | ||
new object[] { 3, 4, 5 } | ||
}; | ||
} | ||
[TestCaseSource(typeof(AnotherClass), nameof(AnotherClass.CasesSource))] | ||
public void CasesSourceAnotherClassTest(int i, int j, int k) | ||
{ | ||
Assert.True(i > 0); | ||
Assert.True(j > 0); | ||
Assert.True(k > 0); | ||
} | ||
|
||
public static IEnumerable TestCaseDatas | ||
{ | ||
get | ||
{ | ||
yield return new TestCaseData(0).Returns(false); | ||
yield return new TestCaseData(1).Returns(true); | ||
yield return new TestCaseData(2).Returns(true); | ||
yield return new TestCaseData(3).Returns(true); | ||
} | ||
} | ||
[TestCaseSource(nameof(TestCaseDatas))] | ||
public bool CasesSourceTestCaseDataTest(int i) | ||
{ | ||
return i > 0; | ||
} | ||
} | ||
} |
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,45 @@ | ||
using NUnit.Framework; | ||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
|
||
namespace ricaun.NUnit.Tests.Revit | ||
{ | ||
public class RevitRunTests | ||
{ | ||
private string GetPathFile(string filePath) | ||
{ | ||
var location = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); | ||
return Path.Combine(location, filePath); | ||
} | ||
|
||
[TestCase("Revit\\RevitTest.dll")] | ||
[TestCase("Revit\\RevitTestDB.dll")] | ||
public void GetTests(string pathFile) | ||
{ | ||
var names = TestEngine.GetTestFullNames(GetPathFile(pathFile)); | ||
|
||
foreach (var name in names) | ||
Console.WriteLine($"{name}"); | ||
|
||
foreach (var ex in TestEngine.Exceptions) | ||
{ | ||
Console.WriteLine($"Exception: {ex.Message}"); | ||
} | ||
} | ||
|
||
[TestCase("Revit\\RevitTest.dll")] | ||
[TestCase("Revit\\RevitTestDB.dll")] | ||
public void RunTests(string pathFile) | ||
{ | ||
var testAssemblyModel = TestEngine.TestAssembly(GetPathFile(pathFile)); | ||
|
||
Console.WriteLine(testAssemblyModel.AsString()); | ||
|
||
foreach (var ex in TestEngine.Exceptions) | ||
{ | ||
Console.WriteLine($"Exception: {ex.Message}"); | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.