using Junction.Domain.Protocols; using Xunit; namespace Junction.Tests.Unit { /// /// Tests for the plugin manifest POCO models. Data-only: no serialization here /// (JSON parse lives in Core). Covers construction, immutability, null handling, /// and the manifest+path pairing of . /// public class PluginManifestTests { [Fact] public void Manifest_Ctor_HoldsAllValues() { var m = new PluginManifest( "mtconnect", "MTConnect Driver", "Junction.Protocols.MTConnect.dll", "Junction.Protocols.MTConnect.MTConnectDriverFactory", "1.0"); Assert.Equal("mtconnect", m.ProtocolId); Assert.Equal("MTConnect Driver", m.DisplayName); Assert.Equal("Junction.Protocols.MTConnect.dll", m.AssemblyFile); Assert.Equal("Junction.Protocols.MTConnect.MTConnectDriverFactory", m.EntryTypeName); Assert.Equal("1.0", m.ApiVersion); } [Fact] public void Manifest_NullStrings_DefaultToEmpty() { var m = new PluginManifest(null!, null!, null!, null!, null!); Assert.Equal("", m.ProtocolId); Assert.Equal("", m.DisplayName); Assert.Equal("", m.AssemblyFile); Assert.Equal("", m.EntryTypeName); Assert.Equal("", m.ApiVersion); } [Fact] public void Manifest_Properties_AreGetOnly() { var props = typeof(PluginManifest).GetProperties(); Assert.All(props, p => Assert.Null(p.SetMethod)); } [Fact] public void Descriptor_Ctor_PairsManifestAndPath() { var m = new PluginManifest("mtconnect", "MTConnect", "p.dll", "T", "1.0"); var d = new PluginDescriptor(m, "/opt/junction/plugins/mtconnect/p.dll"); Assert.Same(m, d.Manifest); Assert.Equal("/opt/junction/plugins/mtconnect/p.dll", d.AssemblyPath); } [Fact] public void Descriptor_NullPath_DefaultsToEmpty() { var m = new PluginManifest("mtconnect", "MTConnect", "p.dll", "T", "1.0"); var d = new PluginDescriptor(m, null!); Assert.Equal("", d.AssemblyPath); } [Fact] public void Descriptor_Properties_AreGetOnly() { var props = typeof(PluginDescriptor).GetProperties(); Assert.All(props, p => Assert.Null(p.SetMethod)); } } }