-
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.
- Loading branch information
Showing
27 changed files
with
148 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:Int64 x:Key="/Default/Environment/UnitTesting/ParallelProcessesCount/@EntryValue">5</s:Int64> | ||
<s:String x:Key="/Default/Environment/UnitTesting/XunitProvider/TestDiscoveryFromArtifactsMethod/@EntryValue">TestRunner</s:String> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Xunit/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> |
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 |
---|---|---|
@@ -1,26 +1,13 @@ | ||
namespace EasyTestFileXunit.Internal | ||
{ | ||
using System; | ||
using System.Reflection; | ||
using EasyTestFileXunit; | ||
|
||
internal static class MethodInfoResolver | ||
{ | ||
// //var type = info.ReflectedType!; | ||
|
||
public static bool TryGet(out MethodInfo? value) | ||
{ | ||
return UsesEasyTestFileAttribute.TryGet(out value); | ||
} | ||
|
||
public static MethodInfo Get() | ||
{ | ||
if (!TryGet(out MethodInfo? info)) | ||
{ | ||
throw new Exception("Expected Test.TypeInfo and Test.Method to not be null. Raise a Pull Request with a test that replicates this problem."); | ||
} | ||
|
||
return info!; | ||
} | ||
} | ||
} |
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
1 change: 1 addition & 0 deletions
1
tests/EasyTestFile.Nunit.Tests/Property/PropertyLoading.MyData.testfile.txt
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 @@ | ||
From textfile |
1 change: 1 addition & 0 deletions
1
tests/EasyTestFile.Nunit.Tests/Property/PropertyLoading.MyData2.testfile.txt
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 @@ | ||
From textfile2 |
1 change: 1 addition & 0 deletions
1
tests/EasyTestFile.Nunit.Tests/Property/PropertyLoading.MyData3.testfile.txt
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 @@ | ||
From textfile3 |
47 changes: 47 additions & 0 deletions
47
tests/EasyTestFile.Nunit.Tests/Property/PropertyLoading.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,47 @@ | ||
namespace EasyTestFileNunit.Tests.Property; | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
using FluentAssertions; | ||
using global::EasyTestFile; | ||
using global::EasyTestFile.Json; | ||
using NUnit.Framework; | ||
|
||
public class PropertyLoading | ||
{ | ||
// EasyTestFile loads the data before the test started. | ||
private string _text1; | ||
private string _text2; | ||
|
||
private static TestFile MyData => EasyTestFileNunit.EasyTestFile.Load(); | ||
|
||
private static TestFile MyData2 { get; } = EasyTestFileNunit.EasyTestFile.Load(); | ||
|
||
private static string MyData3 => EasyTestFileNunit.EasyTestFile.LoadAsText().GetAwaiter().GetResult(); | ||
|
||
[SetUp] | ||
public async Task InitializeAsync() | ||
{ | ||
// this is executed before the test | ||
_text1 = await MyData.AsText(); | ||
_text2 = await MyData2.AsText(); | ||
} | ||
|
||
[Test] | ||
public void Test1() | ||
{ | ||
_text1.Should().Be("From textfile"); | ||
} | ||
|
||
[Test] | ||
public void Test2() | ||
{ | ||
_text2.Should().Be("From textfile2"); | ||
} | ||
|
||
[Test] | ||
public void Test3() | ||
{ | ||
MyData3.Should().Be("From textfile3"); | ||
} | ||
} |
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
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
1 change: 1 addition & 0 deletions
1
tests/EasyTestFile.Xunit.Tests/Property/PropertyLoading.MyData.testfile.txt
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 @@ | ||
From textfile |
1 change: 1 addition & 0 deletions
1
tests/EasyTestFile.Xunit.Tests/Property/PropertyLoading.MyData2.testfile.txt
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 @@ | ||
From textfile2 |
1 change: 1 addition & 0 deletions
1
tests/EasyTestFile.Xunit.Tests/Property/PropertyLoading.MyData3.testfile.txt
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 @@ | ||
From textfile3 |
56 changes: 56 additions & 0 deletions
56
tests/EasyTestFile.Xunit.Tests/Property/PropertyLoading.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,56 @@ | ||
namespace EasyTestFileXunit.Tests.Property; | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
using FluentAssertions; | ||
using global::EasyTestFile; | ||
using global::EasyTestFile.Json; | ||
using Xunit; | ||
|
||
[UsesEasyTestFile] | ||
public class PropertyLoading : IAsyncLifetime | ||
{ | ||
// EasyTestFile loads the data before the test (fact, theory) started. | ||
// This uses a different approach to detect the current assembly. | ||
// Detection when the test is started is done using the UseEasyTestFile attribute, | ||
// detection before the test is started is done using Assembly.GetCallingAssembly(). | ||
|
||
private string _text1; | ||
private string _text2; | ||
|
||
private static TestFile MyData => EasyTestFileXunit.EasyTestFile.Load(); | ||
|
||
private static TestFile MyData2 { get; } = EasyTestFileXunit.EasyTestFile.Load(); | ||
|
||
private static string MyData3 => EasyTestFileXunit.EasyTestFile.LoadAsText().GetAwaiter().GetResult(); | ||
|
||
public async Task InitializeAsync() | ||
{ | ||
// this is executed before the test | ||
_text1 = await MyData.AsText(); | ||
_text2 = await MyData2.AsText(); | ||
} | ||
|
||
public Task DisposeAsync() | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
|
||
[Fact] | ||
public void Test1() | ||
{ | ||
_text1.Should().Be("From textfile"); | ||
} | ||
|
||
[Fact] | ||
public void Test2() | ||
{ | ||
_text2.Should().Be("From textfile2"); | ||
} | ||
|
||
[Fact] | ||
public void Test3() | ||
{ | ||
MyData3.Should().Be("From textfile3"); | ||
} | ||
} |
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