Apply code style formatting and restore partial modifiers on Avalonia views
Linter/formatter pass across the full codebase. Restores required partial keyword on AXAML code-behind classes that the formatter incorrectly removed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
@@ -6,18 +7,19 @@ using ZB.MOM.WW.LmxOpcUa.Host.Configuration;
|
||||
namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Verifies that application configuration binds correctly from appsettings and that validation catches invalid bridge settings.
|
||||
/// Verifies that application configuration binds correctly from appsettings and that validation catches invalid bridge
|
||||
/// settings.
|
||||
/// </summary>
|
||||
public class ConfigurationLoadingTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Loads the application configuration from the repository appsettings file for binding tests.
|
||||
/// Loads the application configuration from the repository appsettings file for binding tests.
|
||||
/// </summary>
|
||||
/// <returns>The bound application configuration snapshot.</returns>
|
||||
private static AppConfiguration LoadFromJson()
|
||||
{
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.AddJsonFile("appsettings.json", optional: false)
|
||||
.AddJsonFile("appsettings.json", false)
|
||||
.Build();
|
||||
|
||||
var config = new AppConfiguration();
|
||||
@@ -30,7 +32,7 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Confirms that the OPC UA section binds the endpoint and session settings expected by the bridge.
|
||||
/// Confirms that the OPC UA section binds the endpoint and session settings expected by the bridge.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void OpcUa_Section_BindsCorrectly()
|
||||
@@ -46,7 +48,7 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Confirms that the MXAccess section binds runtime timeout and reconnect settings correctly.
|
||||
/// Confirms that the MXAccess section binds runtime timeout and reconnect settings correctly.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void MxAccess_Section_BindsCorrectly()
|
||||
@@ -62,7 +64,7 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Confirms that the Galaxy repository section binds connection and polling settings correctly.
|
||||
/// Confirms that the Galaxy repository section binds connection and polling settings correctly.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void GalaxyRepository_Section_BindsCorrectly()
|
||||
@@ -75,7 +77,7 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Confirms that extended-attribute loading defaults to disabled when not configured.
|
||||
/// Confirms that extended-attribute loading defaults to disabled when not configured.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void GalaxyRepository_ExtendedAttributes_DefaultsFalse()
|
||||
@@ -85,14 +87,15 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Confirms that the extended-attribute flag can be enabled through configuration binding.
|
||||
/// Confirms that the extended-attribute flag can be enabled through configuration binding.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void GalaxyRepository_ExtendedAttributes_BindsFromJson()
|
||||
{
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.AddJsonFile("appsettings.json", optional: false)
|
||||
.AddInMemoryCollection(new[] { new System.Collections.Generic.KeyValuePair<string, string>("GalaxyRepository:ExtendedAttributes", "true") })
|
||||
.AddJsonFile("appsettings.json", false)
|
||||
.AddInMemoryCollection(new[]
|
||||
{ new KeyValuePair<string, string>("GalaxyRepository:ExtendedAttributes", "true") })
|
||||
.Build();
|
||||
|
||||
var config = new GalaxyRepositoryConfiguration();
|
||||
@@ -101,7 +104,7 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Confirms that the dashboard section binds operator-dashboard settings correctly.
|
||||
/// Confirms that the dashboard section binds operator-dashboard settings correctly.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Dashboard_Section_BindsCorrectly()
|
||||
@@ -113,7 +116,7 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Confirms that the default configuration objects start with the expected bridge defaults.
|
||||
/// Confirms that the default configuration objects start with the expected bridge defaults.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DefaultValues_AreCorrect()
|
||||
@@ -127,7 +130,7 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Confirms that BindAddress can be overridden to a specific hostname or IP.
|
||||
/// Confirms that BindAddress can be overridden to a specific hostname or IP.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void OpcUa_BindAddress_CanBeOverridden()
|
||||
@@ -135,7 +138,7 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.AddInMemoryCollection(new[]
|
||||
{
|
||||
new System.Collections.Generic.KeyValuePair<string, string>("OpcUa:BindAddress", "localhost"),
|
||||
new KeyValuePair<string, string>("OpcUa:BindAddress", "localhost")
|
||||
})
|
||||
.Build();
|
||||
|
||||
@@ -145,7 +148,7 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Confirms that a valid configuration passes startup validation.
|
||||
/// Confirms that a valid configuration passes startup validation.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Validator_ValidConfig_ReturnsTrue()
|
||||
@@ -155,7 +158,7 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Confirms that an invalid OPC UA port is rejected by startup validation.
|
||||
/// Confirms that an invalid OPC UA port is rejected by startup validation.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Validator_InvalidPort_ReturnsFalse()
|
||||
@@ -166,7 +169,7 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Confirms that an empty Galaxy name is rejected because the bridge requires a namespace target.
|
||||
/// Confirms that an empty Galaxy name is rejected because the bridge requires a namespace target.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Validator_EmptyGalaxyName_ReturnsFalse()
|
||||
@@ -177,7 +180,7 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Confirms that the Security section binds profile list from appsettings.json.
|
||||
/// Confirms that the Security section binds profile list from appsettings.json.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Security_Section_BindsProfilesCorrectly()
|
||||
@@ -189,7 +192,7 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Confirms that a minimum key size below 2048 is rejected by the validator.
|
||||
/// Confirms that a minimum key size below 2048 is rejected by the validator.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Validator_InvalidMinKeySize_ReturnsFalse()
|
||||
@@ -200,7 +203,7 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Confirms that a valid configuration with security defaults passes validation.
|
||||
/// Confirms that a valid configuration with security defaults passes validation.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Validator_DefaultSecurityConfig_ReturnsTrue()
|
||||
@@ -210,7 +213,7 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Confirms that custom security profiles can be bound from in-memory configuration.
|
||||
/// Confirms that custom security profiles can be bound from in-memory configuration.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Security_Section_BindsCustomProfiles()
|
||||
@@ -218,10 +221,10 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.AddInMemoryCollection(new[]
|
||||
{
|
||||
new System.Collections.Generic.KeyValuePair<string, string>("Security:Profiles:0", "None"),
|
||||
new System.Collections.Generic.KeyValuePair<string, string>("Security:Profiles:1", "Basic256Sha256-SignAndEncrypt"),
|
||||
new System.Collections.Generic.KeyValuePair<string, string>("Security:AutoAcceptClientCertificates", "false"),
|
||||
new System.Collections.Generic.KeyValuePair<string, string>("Security:MinimumCertificateKeySize", "4096"),
|
||||
new KeyValuePair<string, string>("Security:Profiles:0", "None"),
|
||||
new KeyValuePair<string, string>("Security:Profiles:1", "Basic256Sha256-SignAndEncrypt"),
|
||||
new KeyValuePair<string, string>("Security:AutoAcceptClientCertificates", "false"),
|
||||
new KeyValuePair<string, string>("Security:MinimumCertificateKeySize", "4096")
|
||||
})
|
||||
.Build();
|
||||
|
||||
@@ -253,12 +256,12 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.AddInMemoryCollection(new[]
|
||||
{
|
||||
new System.Collections.Generic.KeyValuePair<string, string>("Redundancy:Enabled", "true"),
|
||||
new System.Collections.Generic.KeyValuePair<string, string>("Redundancy:Mode", "Hot"),
|
||||
new System.Collections.Generic.KeyValuePair<string, string>("Redundancy:Role", "Secondary"),
|
||||
new System.Collections.Generic.KeyValuePair<string, string>("Redundancy:ServiceLevelBase", "180"),
|
||||
new System.Collections.Generic.KeyValuePair<string, string>("Redundancy:ServerUris:0", "urn:a"),
|
||||
new System.Collections.Generic.KeyValuePair<string, string>("Redundancy:ServerUris:1", "urn:b"),
|
||||
new KeyValuePair<string, string>("Redundancy:Enabled", "true"),
|
||||
new KeyValuePair<string, string>("Redundancy:Mode", "Hot"),
|
||||
new KeyValuePair<string, string>("Redundancy:Role", "Secondary"),
|
||||
new KeyValuePair<string, string>("Redundancy:ServiceLevelBase", "180"),
|
||||
new KeyValuePair<string, string>("Redundancy:ServerUris:0", "urn:a"),
|
||||
new KeyValuePair<string, string>("Redundancy:ServerUris:1", "urn:b")
|
||||
})
|
||||
.Build();
|
||||
|
||||
@@ -304,7 +307,7 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.AddInMemoryCollection(new[]
|
||||
{
|
||||
new System.Collections.Generic.KeyValuePair<string, string>("OpcUa:ApplicationUri", "urn:test:app"),
|
||||
new KeyValuePair<string, string>("OpcUa:ApplicationUri", "urn:test:app")
|
||||
})
|
||||
.Build();
|
||||
|
||||
@@ -313,4 +316,4 @@ namespace ZB.MOM.WW.LmxOpcUa.Tests.Configuration
|
||||
config.ApplicationUri.ShouldBe("urn:test:app");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user