Complete management API and CLI command parity
This commit is contained in:
+3
-1
@@ -15,7 +15,9 @@ public class ManagementCommandRegistryTests
|
||||
typeof(ManagementEnvelope).Assembly.GetTypes()
|
||||
.Where(t => t.Namespace == typeof(ManagementEnvelope).Namespace
|
||||
&& t.Name.EndsWith("Command", StringComparison.Ordinal)
|
||||
&& !t.IsAbstract);
|
||||
&& !t.IsAbstract
|
||||
&& t != typeof(ReadTagValuesCommand)
|
||||
&& t != typeof(ResolveRolesCommand));
|
||||
|
||||
[Fact]
|
||||
public void GetCommandName_Resolve_RoundTrips_ForEveryRegisteredCommand()
|
||||
|
||||
+6
-15
@@ -2,23 +2,14 @@ using ZB.MOM.WW.ScadaBridge.Commons.Messages.Management;
|
||||
|
||||
namespace ZB.MOM.WW.ScadaBridge.Commons.Tests.Messages;
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="ReadTagValuesCommand"/> is discovered by
|
||||
/// <see cref="ManagementCommandRegistry"/> so it travels over the management
|
||||
/// boundary as a known command (resolvable by wire name and round-trippable
|
||||
/// through <c>GetCommandName</c> / <c>Resolve</c>). Mirrors
|
||||
/// <see cref="BrowseCommandsRegistryTests"/>.
|
||||
/// </summary>
|
||||
public class ReadTagValuesCommandRegistryTests
|
||||
{
|
||||
[Fact]
|
||||
public void Registry_discovers_ReadTagValuesCommand()
|
||||
[Theory]
|
||||
[InlineData(typeof(ReadTagValuesCommand), "ReadTagValues")]
|
||||
[InlineData(typeof(ResolveRolesCommand), "ResolveRoles")]
|
||||
public void SiteOnlyAndRetiredCommands_AreNotHttpCommands(Type type, string wireName)
|
||||
{
|
||||
// GetCommandName throws ArgumentException for any type the registry
|
||||
// does not contain, so a successful call here is proof of discovery.
|
||||
var name = ManagementCommandRegistry.GetCommandName(typeof(ReadTagValuesCommand));
|
||||
|
||||
Assert.Equal("ReadTagValues", name);
|
||||
Assert.Equal(typeof(ReadTagValuesCommand), ManagementCommandRegistry.Resolve(name));
|
||||
Assert.Null(ManagementCommandRegistry.Resolve(wireName));
|
||||
Assert.Throws<ArgumentException>(() => ManagementCommandRegistry.GetCommandName(type));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user