mirror of
https://github.com/DuendeSoftware/products
synced 2026-05-23 17:08:21 +00:00
51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
// Copyright (c) Duende Software. All rights reserved.
|
|
// See LICENSE in the project root for license information.
|
|
|
|
using System.Runtime.Loader;
|
|
using Duende.Cli.Plugins;
|
|
|
|
namespace Duende.Cli.IntegrationTests;
|
|
|
|
public class PluginLoaderTests
|
|
{
|
|
private static readonly string AssemblyPath =
|
|
typeof(Duende.Cli.TestPlugin.TestCliPlugin).Assembly.Location;
|
|
|
|
[Fact]
|
|
public void PluginLoadsViaPluginLoader()
|
|
{
|
|
var plugin = PluginLoader.Load(AssemblyPath);
|
|
|
|
plugin.Name.ShouldBe("test");
|
|
}
|
|
|
|
[Fact]
|
|
public void PluginReturnsCommandWithCorrectName()
|
|
{
|
|
var plugin = PluginLoader.Load(AssemblyPath);
|
|
|
|
var command = plugin.GetCommand();
|
|
|
|
command.Name.ShouldBe("test");
|
|
}
|
|
|
|
[Fact]
|
|
public void PluginCommandHasSubcommand()
|
|
{
|
|
var plugin = PluginLoader.Load(AssemblyPath);
|
|
|
|
var command = plugin.GetCommand();
|
|
|
|
command.Subcommands.ShouldContain(c => c.Name == "hello");
|
|
}
|
|
|
|
[Fact]
|
|
public void PluginLoadsInIsolatedAlc()
|
|
{
|
|
var plugin = PluginLoader.Load(AssemblyPath);
|
|
|
|
var context = AssemblyLoadContext.GetLoadContext(plugin.GetType().Assembly);
|
|
|
|
context.ShouldNotBe(AssemblyLoadContext.Default);
|
|
}
|
|
}
|