-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basic unit test structure for SimplePolicyPlugin
- Loading branch information
1 parent
39f0bde
commit d87b47e
Showing
5 changed files
with
94 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp2.0</TargetFramework> | ||
<AssemblyName>SimplePolicy.UnitTests</AssemblyName> | ||
<RootNamespace>SimplePolicy.UnitTests</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="FluentAssertions" Version="4.19.4" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" /> | ||
<PackageReference Include="MSTest.TestAdapter" Version="1.2.0" /> | ||
<PackageReference Include="MSTest.TestFramework" Version="1.2.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\SimplePolicy\SimplePolicy.csproj" /> | ||
</ItemGroup> | ||
|
||
<!-- | ||
<ItemGroup> | ||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" /> | ||
</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,34 @@ | ||
using Microsoft.Extensions.Configuration; | ||
using System.IO; | ||
using System.Reflection; | ||
using System; | ||
using FluentAssertions; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Neo.Plugins; | ||
|
||
|
||
namespace SimplePolicy.UnitTests | ||
{ | ||
[TestClass] | ||
public class UT_SimplePolicy | ||
{ | ||
SimplePolicyPlugin uut; | ||
|
||
[TestInitialize] | ||
public void TestSetup() | ||
{ | ||
string path = Path.Combine("Plugins", Assembly.GetExecutingAssembly().GetName().Name); | ||
string relativepath = "/../../../../../config.json"; | ||
string fullpath = Path.GetFullPath(path + relativepath); | ||
IConfigurationSection config = new ConfigurationBuilder().AddJsonFile(fullpath).Build().GetSection("PluginConfiguration"); | ||
SimplePolicyPlugin.SetConfiguration(config); | ||
uut = new SimplePolicyPlugin(); | ||
} | ||
|
||
[TestMethod] | ||
public void TestMaxTransactionsPerBlock() | ||
{ | ||
uut.GetMaxTransactionsPerBlock().Should().Be(500); | ||
} | ||
} | ||
} |
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,10 @@ | ||
{ | ||
"PluginConfiguration": { | ||
"MaxTransactionsPerBlock": 500, | ||
"MaxFreeTransactionsPerBlock": 20, | ||
"BlockedAccounts": { | ||
"Type": "AllowAll", | ||
"List": [] | ||
} | ||
} | ||
} |
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