feat: acquire legacy settings from approved network source
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using Launcher.Next.Application;
|
||||
using Xunit;
|
||||
|
||||
namespace Launcher.Next.Tests;
|
||||
|
||||
public sealed class LegacyNetworkSettingsParserTests
|
||||
{
|
||||
[Fact]
|
||||
public void FullLegacyPattern_PreservesSourcesAttributesAndMachineRestriction()
|
||||
{
|
||||
const string xml = "<root><path><help>h</help><care>c</care></path><data><pattern><name>Plant 3D_2019</name><filter>Project files |Project.xml|All files (*.*)|*.*</filter><roster>%PROJECTDIRECTORY%\\..\\_System\\Plant 3D_2019\\Applications\\download_list.xml</roster><source><course>N:\\BIM\\save\\Apps\\Plant3D\\DriveA</course></source><source><course>N:\\BIM\\save\\Apps\\Plant3D\\DriveQ</course></source><target>target</target><loader>loader</loader><object>object</object><attrib>first</attrib><attrib>second</attrib></pattern><plugin><id>b455ee6eaed79d76f084846a60ce3284</id><renewal></renewal><catalog>P_Rec_Annot</catalog><install>OrthoLoader.dll</install><machine>BUILD-01</machine></plugin></data></root>";
|
||||
var settings = new LegacyConfigurationAdapter().ParseSettings(xml);
|
||||
var pattern = Assert.Single(settings.Patterns);
|
||||
Assert.Equal(["N:\\BIM\\save\\Apps\\Plant3D\\DriveA", "N:\\BIM\\save\\Apps\\Plant3D\\DriveQ"], pattern.Sources);
|
||||
Assert.Equal(["first", "second"], pattern.Attributes);
|
||||
Assert.Equal("target", pattern.Target);
|
||||
var plugin = Assert.Single(pattern.Plugins);
|
||||
Assert.Equal("P_Rec_Annot", plugin.Catalog);
|
||||
Assert.True(plugin.IsAllowedOn("build-01"));
|
||||
Assert.False(plugin.IsAllowedOn("OTHER"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PluginWithoutMachineRestriction_IsAllowedEverywhere()
|
||||
{
|
||||
var plugin = new LegacyPluginDefinition("id", "", "catalog", "install", 0);
|
||||
Assert.True(plugin.IsAllowedOn(Environment.MachineName));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user