Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -4,6 +4,7 @@ using Microsoft.Extensions.Logging.Abstractions;
|
||||
using StellaOps.Microservice;
|
||||
using Xunit;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Microservice.Tests;
|
||||
|
||||
/// <summary>
|
||||
@@ -29,7 +30,8 @@ public class MicroserviceYamlLoaderTests : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Load_ReturnsNull_WhenConfigFilePathIsNull()
|
||||
{
|
||||
var options = new StellaMicroserviceOptions
|
||||
@@ -46,7 +48,8 @@ public class MicroserviceYamlLoaderTests : IDisposable
|
||||
result.Should().BeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Load_ReturnsNull_WhenConfigFilePathIsEmpty()
|
||||
{
|
||||
var options = new StellaMicroserviceOptions
|
||||
@@ -63,7 +66,8 @@ public class MicroserviceYamlLoaderTests : IDisposable
|
||||
result.Should().BeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Load_ReturnsNull_WhenFileDoesNotExist()
|
||||
{
|
||||
var options = new StellaMicroserviceOptions
|
||||
@@ -80,7 +84,8 @@ public class MicroserviceYamlLoaderTests : IDisposable
|
||||
result.Should().BeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Load_ParsesValidYaml()
|
||||
{
|
||||
var yamlContent = """
|
||||
@@ -111,7 +116,8 @@ public class MicroserviceYamlLoaderTests : IDisposable
|
||||
result.Endpoints[0].SupportsStreaming.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Load_ParsesMultipleEndpoints()
|
||||
{
|
||||
var yamlContent = """
|
||||
@@ -143,7 +149,8 @@ public class MicroserviceYamlLoaderTests : IDisposable
|
||||
result!.Endpoints.Should().HaveCount(3);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Load_ParsesClaimRequirements()
|
||||
{
|
||||
var yamlContent = """
|
||||
@@ -178,7 +185,8 @@ public class MicroserviceYamlLoaderTests : IDisposable
|
||||
result.Endpoints[0].RequiringClaims![1].Value.Should().Be("delete");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Load_HandlesEmptyEndpointsList()
|
||||
{
|
||||
var yamlContent = """
|
||||
@@ -201,7 +209,8 @@ public class MicroserviceYamlLoaderTests : IDisposable
|
||||
result!.Endpoints.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Load_IgnoresUnknownProperties()
|
||||
{
|
||||
var yamlContent = """
|
||||
@@ -228,7 +237,8 @@ public class MicroserviceYamlLoaderTests : IDisposable
|
||||
result!.Endpoints.Should().HaveCount(1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Load_ThrowsOnInvalidYaml()
|
||||
{
|
||||
var yamlContent = """
|
||||
@@ -252,7 +262,8 @@ public class MicroserviceYamlLoaderTests : IDisposable
|
||||
act.Should().Throw<Exception>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Load_ResolvesRelativePath()
|
||||
{
|
||||
var yamlContent = """
|
||||
|
||||
Reference in New Issue
Block a user