Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
fa5591a
test: Create test project
DevD4v3 Nov 15, 2023
7bb3cd9
chore: Add test project to solution file
DevD4v3 Nov 15, 2023
574fadc
chore: Add new package for testing
DevD4v3 Nov 15, 2023
f51de39
chore: Update .props file
DevD4v3 Nov 23, 2023
2e6f130
chore: Delete files
DevD4v3 Nov 24, 2023
b1caa38
test: Add the test project to the tests/CPlugin.Net/ folder
DevD4v3 Nov 24, 2023
92a397c
chore: Add test projects in the solution file
DevD4v3 Nov 24, 2023
08f3e84
test: Add plug-in test projects
DevD4v3 Nov 24, 2023
bea7d52
test: Add contract project for testing
DevD4v3 Nov 25, 2023
f8f7a03
test: Add plugin host project for testing
DevD4v3 Nov 25, 2023
85a4b72
chore: Create .pros file for all test plugins
DevD4v3 Nov 25, 2023
4988191
chore: Create PluginProjectRef file
DevD4v3 Nov 25, 2023
cb3fba6
chore: Add references from test projects
DevD4v3 Nov 25, 2023
c255d86
chore: Add comments
DevD4v3 Nov 25, 2023
114c748
test: Add tests for CPluginEnvConfiguration class
DevD4v3 Nov 25, 2023
48e32a2
test: Add test case when it does not have .dll extension
DevD4v3 Nov 25, 2023
fdf0736
chore: Add resources directory
DevD4v3 Nov 25, 2023
b99bc85
test: Add tests for CPluginJsonConfiguration class
DevD4v3 Nov 25, 2023
453f32e
test: Add test case to get the plugin files from a .env
DevD4v3 Nov 25, 2023
3d95e1c
chore: Create .env file
DevD4v3 Nov 25, 2023
f0c442b
chore: Add dotenv package to test project
DevD4v3 Nov 25, 2023
2d835b1
test: Add test case when argument is null
DevD4v3 Nov 25, 2023
58b9576
style: Add comment
DevD4v3 Nov 25, 2023
5499388
refactor: Inject the enumerable into the controller
DevD4v3 Nov 26, 2023
f01f2e4
test: Add tests for PluginAttribute class
DevD4v3 Nov 26, 2023
94172fc
refactor: Allow new separators
DevD4v3 Nov 26, 2023
17a736a
chore: Rename test file
DevD4v3 Nov 26, 2023
839cda5
refactor: Get version of Newtonsoft.Json assembly
DevD4v3 Nov 26, 2023
8c71968
test: Add create method to the test plugin
DevD4v3 Nov 26, 2023
6b524a9
test: Add create method to the plugin host
DevD4v3 Nov 26, 2023
0448322
chore: Update global usings
DevD4v3 Nov 26, 2023
dcba5f4
test: Add test to the loader
DevD4v3 Nov 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 48 additions & 4 deletions CPlugin.Net.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CPlugin.Net.Attributes", "s
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CPlugin.Net", "src\Core\CPlugin.Net.csproj", "{116B353F-FC68-4412-8A2D-34DA0BE88060}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CPlugin.Net.Tests", "tests\CPlugin.Net\CPlugin.Net.Tests.csproj", "{2F9DE570-146C-44E3-BF2F-14CFA5C3803F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.Contracts", "samples\Contracts\Example.Contracts.csproj", "{BBDE7F3C-2A41-40B6-B609-839D09676D0E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.ConsoleApp", "samples\HostApplications\ConsoleApp\Example.ConsoleApp.csproj", "{3E943746-09CD-430E-9BBF-67DBBF9F5CEF}"
Expand All @@ -23,11 +25,25 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.AppointmentPlugin",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.PersonPlugin", "samples\Plugins\PersonPlugin\Example.PersonPlugin.csproj", "{18534944-583B-4924-AC5B-E0655FD92AAC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestProject.JsonPlugin", "tests\Plugins\TestProject.JsonPlugin\TestProject.JsonPlugin.csproj", "{0F27C776-F284-4C94-86C9-0FF089245E13}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestProject.OldJsonPlugin", "tests\Plugins\TestProject.OldJsonPlugin\TestProject.OldJsonPlugin.csproj", "{BCE8FA91-AF31-49DD-BED8-E60A46915400}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestProject.WebPlugin", "tests\Plugins\TestProject.WebPlugin\TestProject.WebPlugin.csproj", "{C6EC1C5D-15E7-44BD-8E03-8CF9A033DE25}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestProject.HelloPlugin", "tests\Plugins\TestProject.HelloPlugin\TestProject.HelloPlugin.csproj", "{E2373A36-6D3E-44DE-99FF-4CC019E05D06}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestProject.Contracts", "tests\TestProject.Contracts\TestProject.Contracts.csproj", "{FEE1E508-3313-4C7A-A7E6-5EBA8D47D3FD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestProject.PluginHost", "tests\TestProject.PluginHost\TestProject.PluginHost.csproj", "{0BCD3305-F0D5-43E6-B879-EEF0827558A8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DA150C23-F1A9-42CF-899C-6C4E6B940E72}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
samples\Plugins\Directory.Build.props = samples\Plugins\Directory.Build.props
tests\Plugins\Directory.Build.props = tests\Plugins\Directory.Build.props
Directory.Packages.props = Directory.Packages.props
tests\CPlugin.Net\PluginProjectRef.targets = tests\CPlugin.Net\PluginProjectRef.targets
EndProjectSection
EndProject
Global
Expand All @@ -44,6 +60,10 @@ Global
{116B353F-FC68-4412-8A2D-34DA0BE88060}.Debug|Any CPU.Build.0 = Debug|Any CPU
{116B353F-FC68-4412-8A2D-34DA0BE88060}.Release|Any CPU.ActiveCfg = Release|Any CPU
{116B353F-FC68-4412-8A2D-34DA0BE88060}.Release|Any CPU.Build.0 = Release|Any CPU
{2F9DE570-146C-44E3-BF2F-14CFA5C3803F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F9DE570-146C-44E3-BF2F-14CFA5C3803F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F9DE570-146C-44E3-BF2F-14CFA5C3803F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F9DE570-146C-44E3-BF2F-14CFA5C3803F}.Release|Any CPU.Build.0 = Release|Any CPU
{BBDE7F3C-2A41-40B6-B609-839D09676D0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BBDE7F3C-2A41-40B6-B609-839D09676D0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BBDE7F3C-2A41-40B6-B609-839D09676D0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -56,6 +76,10 @@ Global
{C221B4F0-857F-4380-B5AD-E4B2BBA65622}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C221B4F0-857F-4380-B5AD-E4B2BBA65622}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C221B4F0-857F-4380-B5AD-E4B2BBA65622}.Release|Any CPU.Build.0 = Release|Any CPU
{F66A1430-3F32-4E25-8966-54D502D216DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F66A1430-3F32-4E25-8966-54D502D216DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F66A1430-3F32-4E25-8966-54D502D216DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F66A1430-3F32-4E25-8966-54D502D216DE}.Release|Any CPU.Build.0 = Release|Any CPU
{C5B8EF73-7DB5-441F-AE38-0988751A896B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C5B8EF73-7DB5-441F-AE38-0988751A896B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C5B8EF73-7DB5-441F-AE38-0988751A896B}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -72,10 +96,30 @@ Global
{18534944-583B-4924-AC5B-E0655FD92AAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{18534944-583B-4924-AC5B-E0655FD92AAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{18534944-583B-4924-AC5B-E0655FD92AAC}.Release|Any CPU.Build.0 = Release|Any CPU
{F66A1430-3F32-4E25-8966-54D502D216DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F66A1430-3F32-4E25-8966-54D502D216DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F66A1430-3F32-4E25-8966-54D502D216DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F66A1430-3F32-4E25-8966-54D502D216DE}.Release|Any CPU.Build.0 = Release|Any CPU
{0F27C776-F284-4C94-86C9-0FF089245E13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0F27C776-F284-4C94-86C9-0FF089245E13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0F27C776-F284-4C94-86C9-0FF089245E13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0F27C776-F284-4C94-86C9-0FF089245E13}.Release|Any CPU.Build.0 = Release|Any CPU
{BCE8FA91-AF31-49DD-BED8-E60A46915400}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BCE8FA91-AF31-49DD-BED8-E60A46915400}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BCE8FA91-AF31-49DD-BED8-E60A46915400}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BCE8FA91-AF31-49DD-BED8-E60A46915400}.Release|Any CPU.Build.0 = Release|Any CPU
{C6EC1C5D-15E7-44BD-8E03-8CF9A033DE25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C6EC1C5D-15E7-44BD-8E03-8CF9A033DE25}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C6EC1C5D-15E7-44BD-8E03-8CF9A033DE25}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C6EC1C5D-15E7-44BD-8E03-8CF9A033DE25}.Release|Any CPU.Build.0 = Release|Any CPU
{E2373A36-6D3E-44DE-99FF-4CC019E05D06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E2373A36-6D3E-44DE-99FF-4CC019E05D06}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E2373A36-6D3E-44DE-99FF-4CC019E05D06}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E2373A36-6D3E-44DE-99FF-4CC019E05D06}.Release|Any CPU.Build.0 = Release|Any CPU
{FEE1E508-3313-4C7A-A7E6-5EBA8D47D3FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FEE1E508-3313-4C7A-A7E6-5EBA8D47D3FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FEE1E508-3313-4C7A-A7E6-5EBA8D47D3FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FEE1E508-3313-4C7A-A7E6-5EBA8D47D3FD}.Release|Any CPU.Build.0 = Release|Any CPU
{0BCD3305-F0D5-43E6-B879-EEF0827558A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0BCD3305-F0D5-43E6-B879-EEF0827558A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0BCD3305-F0D5-43E6-B879-EEF0827558A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0BCD3305-F0D5-43E6-B879-EEF0827558A8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<NoWarn>1591</NoWarn>
<NoWarn>1591;NU1903</NoWarn>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageVersion Include="SimpleResults.AspNetCore" Version="1.0.0" />
<PackageVersion Include="DotEnv.Core" Version="3.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.3" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageVersion Include="FluentAssertions" Version="6.10.0" />
<PackageVersion Include="NUnit" Version="3.13.3" />
Expand Down
4 changes: 3 additions & 1 deletion src/Core/Configuration/CPluginEnvConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ namespace CPlugin.Net;
/// </remarks>
public class CPluginEnvConfiguration : CPluginConfigurationBase
{
private static readonly string[] s_separator = { " ", "\t", "\r\n", "\n", "\r" };

/// <summary>
/// Initializes a new instance of the <see cref="CPluginEnvConfiguration"/> class.
/// </summary>
Expand All @@ -27,7 +29,7 @@ public override IEnumerable<string> GetPluginFiles()
return Enumerable.Empty<string>();

var pluginFiles = retrievedValue
.Split(" ")
.Split(s_separator, StringSplitOptions.None)
.Where(pluginFile => !string.IsNullOrWhiteSpace(pluginFile))
.Select(GetPluginPath);

Expand Down
18 changes: 18 additions & 0 deletions tests/CPlugin.Net/Attributes/PluginAttributeTestCases.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace CPlugin.Net.Tests.Attributes;

public class PluginAttributeTestCases : IEnumerable
{
public IEnumerator GetEnumerator()
{
yield return typeof(IExample);
yield return typeof(ExampleBase);
yield return typeof(AbstractExample);
yield return typeof(EnumExample);
yield return typeof(int);
}
}

public interface IExample { }
public abstract class ExampleBase { }
public abstract class AbstractExample : IExample { }
public enum EnumExample { }
50 changes: 50 additions & 0 deletions tests/CPlugin.Net/Attributes/PluginAttributeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
namespace CPlugin.Net.Tests.Attributes;

public class PluginAttributeTests
{
[Test]
public void Constructor_WhenArgumentIsNull_ShouldThrowArgumentNullException()
{
// Arrange
Type pluginType = default;

// Act
Action act = () =>
{
var attr = new PluginAttribute(pluginType);
};

// Assert
act.Should().Throw<ArgumentNullException>();
}

[TestCaseSource(typeof(PluginAttributeTestCases))]
public void Constructor_WhenTypeIsNotInstantiable_ShouldThrowArgumentException(Type pluginType)
{
// Act
Action act = () =>
{
var attr = new PluginAttribute(pluginType);
};

// Assert
act.Should()
.Throw<ArgumentException>()
.WithParameterName(nameof(pluginType));
}

[Test]
public void Constructor_WhenTypeIsInstantiable_ShouldNotThrowException()
{
// Arrange
Type expected = typeof(Example);

// Act
var actual = new PluginAttribute(expected);

// Assert
actual.PluginType.Should().Be(expected);
}

private class Example { }
}
41 changes: 41 additions & 0 deletions tests/CPlugin.Net/CPlugin.Net.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<RootNamespace>CPlugin.Net.Tests</RootNamespace>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DotEnv.Core" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="NUnit.Analyzers" />
<PackageReference Include="coverlet.msbuild">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<!--
These references were added only so that all plugin projects could be compiled.
Especially when done from the command line interface (CLI) with dotnet test.
-->
<PluginProjectReference Include="..\Plugins\TestProject.HelloPlugin\TestProject.HelloPlugin.csproj" />
<PluginProjectReference Include="..\Plugins\TestProject.JsonPlugin\TestProject.JsonPlugin.csproj" />
<PluginProjectReference Include="..\Plugins\TestProject.OldJsonPlugin\TestProject.OldJsonPlugin.csproj" />
<PluginProjectReference Include="..\Plugins\TestProject.WebPlugin\TestProject.WebPlugin.csproj" />
<!-- End -->

<ProjectReference Include="..\TestProject.Contracts\TestProject.Contracts.csproj" />
<ProjectReference Include="..\TestProject.PluginHost\TestProject.PluginHost.csproj" />
</ItemGroup>

<Import Project="PluginProjectRef.targets" />

</Project>
126 changes: 126 additions & 0 deletions tests/CPlugin.Net/Core/CPluginEnvConfigurationTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
namespace CPlugin.Net.Tests.Core;

public class CPluginEnvConfigurationTests
{
private class EnvConfigurationTestCases : IEnumerable
{
public IEnumerator GetEnumerator()
{
yield return " TestProject.JsonPlugin.dll TestProject.OldJsonPlugin.dll TestProject.WebPlugin.dll ";
yield return $"{'\t'} TestProject.JsonPlugin.dll{'\t'}TestProject.OldJsonPlugin.dll{'\t'}TestProject.WebPlugin.dll{'\t'}";
yield return $"{'\n'} TestProject.JsonPlugin.dll{'\n'}TestProject.OldJsonPlugin.dll{'\n'}TestProject.WebPlugin.dll{'\n'}";
yield return $"{'\r'} TestProject.JsonPlugin.dll{'\r'}TestProject.OldJsonPlugin.dll{'\r'}TestProject.WebPlugin.dll{'\r'}";
yield return $"{"\r\n"} TestProject.JsonPlugin.dll{"\r\n"}TestProject.OldJsonPlugin.dll{"\r\n"}TestProject.WebPlugin.dll{"\r\n"}";

yield return
"""
TestProject.JsonPlugin.dll
TestProject.OldJsonPlugin.dll
TestProject.WebPlugin.dll
""";

yield return
"""
TestProject.JsonPlugin.dll
TestProject.OldJsonPlugin.dll
TestProject.WebPlugin.dll
""";

yield return
$"""
{'\t'}{'\t'} TestProject.JsonPlugin.dll
{'\t'}{'\t'} TestProject.OldJsonPlugin.dll
{'\t'}{'\t'} TestProject.WebPlugin.dll
""";
}
}

[TestCaseSource(typeof(EnvConfigurationTestCases))]
public void GetPluginFiles_WhenPluginFilesArePresent_ShouldReturnsFullPaths(string pluginFiles)
{
// Arrange
Environment.SetEnvironmentVariable("PLUGINS", pluginFiles);
var envConfiguration = new CPluginEnvConfiguration();
var basePath = AppContext.BaseDirectory;
var expectedPaths = new[]
{
Path.Combine(basePath, "plugins", "TestProject.JsonPlugin", "TestProject.JsonPlugin.dll"),
Path.Combine(basePath, "plugins", "TestProject.OldJsonPlugin", "TestProject.OldJsonPlugin.dll"),
Path.Combine(basePath, "plugins", "TestProject.WebPlugin", "TestProject.WebPlugin.dll")
};

// Act
var actual = envConfiguration.GetPluginFiles().ToList();

// Assert
actual.Should().BeEquivalentTo(expectedPaths);
}

[Test]
public void GetPluginFiles_WhenPluginFilesAreObtainedFromEnvFile_ShouldReturnsFullPaths()
{
// Arrange
new EnvLoader()
.AllowOverwriteExistingVars()
.EnableFileNotFoundException()
.SetBasePath("./Resources")
.Load();
var envConfiguration = new CPluginEnvConfiguration();
var basePath = AppContext.BaseDirectory;
var expectedPaths = new[]
{
Path.Combine(basePath, "plugins", "TestProject.JsonPlugin", "TestProject.JsonPlugin.dll"),
Path.Combine(basePath, "plugins", "TestProject.OldJsonPlugin", "TestProject.OldJsonPlugin.dll"),
Path.Combine(basePath, "plugins", "TestProject.WebPlugin", "TestProject.WebPlugin.dll")
};

// Act
var actual = envConfiguration.GetPluginFiles().ToList();

// Assert
actual.Should().BeEquivalentTo(expectedPaths);
}

[Test]
public void GetPluginFiles_WhenPluginFilesAreNotPresent_ShouldReturnsEmptyEnumerable()
{
// Arrange
Environment.SetEnvironmentVariable("PLUGINS", " ");
var envConfiguration = new CPluginEnvConfiguration();

// Act
var actual = envConfiguration.GetPluginFiles().ToList();

// Assert
actual.Should().BeEmpty();
}

[Test]
public void GetPluginFiles_WhenPluginsKeyIsNotPresent_ShouldReturnsEmptyEnumerable()
{
// Arrange
// To ensure that the variable is removed.
Environment.SetEnvironmentVariable("PLUGINS", default);
var envConfiguration = new CPluginEnvConfiguration();

// Act
var actual = envConfiguration.GetPluginFiles().ToList();

// Assert
actual.Should().BeEmpty();
}

[Test]
public void GetPluginFiles_WhenPluginFileDoesNotHaveDllExtension_ShouldThrowArgumentException()
{
// Arrange
Environment.SetEnvironmentVariable("PLUGINS", "TestProject.JsonPlugin");
var envConfiguration = new CPluginEnvConfiguration();

// Act
Action act = () => envConfiguration.GetPluginFiles().ToList();

// Assert
act.Should().Throw<ArgumentException>();
}
}
Loading