-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some sample xUnit tests to publish.
- Loading branch information
1 parent
ecba50b
commit 4fc18f3
Showing
10 changed files
with
130 additions
and
18 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/Agoda.Tests.Metrics.xUnit.Tests/Agoda.Tests.Metrics.xUnit.Tests.csproj
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,29 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" /> | ||
<PackageReference Include="xunit" Version="2.4.2" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="3.2.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Agoda.Tests.Metrics.xUnit\Agoda.Tests.Metrics.xUnit.csproj" /> | ||
</ItemGroup> | ||
|
||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[assembly: Xunit.TestFramework("Agoda.Tests.Metrics.xUnit.AgodaTestFramework", "Agoda.Tests.Metrics.xUnit")] |
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,35 @@ | ||
namespace Agoda.Tests.Metrics.xUnit.Tests | ||
{ | ||
public class TestSuite1 | ||
{ | ||
private readonly Random _random = new Random(); | ||
|
||
[Fact] | ||
public void Test1() | ||
{ | ||
// 25% failure rate | ||
Assert.True(_random.Next(0, 100) > 25); | ||
} | ||
|
||
[Fact] | ||
public void Test2() | ||
{ | ||
// 25% failure rate | ||
Assert.True(_random.Next(0, 100) > 25); | ||
} | ||
|
||
[Fact] | ||
public void Test3() | ||
{ | ||
// 25% failure rate | ||
Assert.True(_random.Next(0, 100) > 25); | ||
} | ||
|
||
[Fact] | ||
public void Test4() | ||
{ | ||
// 25% failure rate | ||
Assert.True(_random.Next(0, 100) > 25); | ||
} | ||
} | ||
} |
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 @@ | ||
namespace Agoda.Tests.Metrics.xUnit.Tests | ||
{ | ||
public class TestSuite2 | ||
{ | ||
private readonly Random _random = new Random(); | ||
|
||
[Fact] | ||
public void Test1() | ||
{ | ||
// 25% failure rate | ||
Assert.True(_random.Next(0, 100) > 25); | ||
} | ||
|
||
[Fact] | ||
public void Test2() | ||
{ | ||
// 25% failure rate | ||
Assert.True(_random.Next(0, 100) > 25); | ||
} | ||
|
||
[Fact] | ||
public void Test3() | ||
{ | ||
// 25% failure rate | ||
Assert.True(_random.Next(0, 100) > 25); | ||
} | ||
|
||
[Fact] | ||
public void Test4() | ||
{ | ||
// 25% failure rate | ||
Assert.True(_random.Next(0, 100) > 25); | ||
} | ||
|
||
[Theory] | ||
[InlineData(100)] | ||
[InlineData(75)] | ||
[InlineData(50)] | ||
[InlineData(25)] | ||
public void Test5(int n) | ||
{ | ||
Assert.True(n > 25); | ||
} | ||
} | ||
} |
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 @@ | ||
global using Xunit; |
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 was deleted.
Oops, something went wrong.
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