Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -2,6 +2,7 @@ using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Moq;
|
||||
using StellaOps.Router.Common.Models;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Microservice.Tests;
|
||||
|
||||
/// <summary>
|
||||
@@ -39,7 +40,8 @@ public sealed class EndpointDiscoveryServiceTests
|
||||
|
||||
#region DiscoverEndpoints Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void DiscoverEndpoints_CallsDiscoveryProvider()
|
||||
{
|
||||
// Arrange
|
||||
@@ -52,7 +54,8 @@ public sealed class EndpointDiscoveryServiceTests
|
||||
_discoveryProviderMock.Verify(d => d.DiscoverEndpoints(), Times.Once);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void DiscoverEndpoints_LoadsYamlConfig()
|
||||
{
|
||||
// Arrange
|
||||
@@ -65,7 +68,8 @@ public sealed class EndpointDiscoveryServiceTests
|
||||
_yamlLoaderMock.Verify(l => l.Load(), Times.Once);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void DiscoverEndpoints_MergesCodeAndYaml()
|
||||
{
|
||||
// Arrange
|
||||
@@ -93,7 +97,8 @@ public sealed class EndpointDiscoveryServiceTests
|
||||
_mergerMock.Verify(m => m.Merge(codeEndpoints, yamlConfig), Times.Once);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void DiscoverEndpoints_ReturnsMergedEndpoints()
|
||||
{
|
||||
// Arrange
|
||||
@@ -119,7 +124,8 @@ public sealed class EndpointDiscoveryServiceTests
|
||||
result.Should().BeSameAs(mergedEndpoints);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void DiscoverEndpoints_WhenYamlLoadFails_UsesCodeEndpointsOnly()
|
||||
{
|
||||
// Arrange
|
||||
@@ -139,7 +145,8 @@ public sealed class EndpointDiscoveryServiceTests
|
||||
_mergerMock.Verify(m => m.Merge(codeEndpoints, null), Times.Once);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void DiscoverEndpoints_WithMultipleEndpoints_ReturnsAll()
|
||||
{
|
||||
// Arrange
|
||||
@@ -162,7 +169,8 @@ public sealed class EndpointDiscoveryServiceTests
|
||||
result.Should().HaveCount(4);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void DiscoverEndpoints_EmptyEndpoints_ReturnsEmptyList()
|
||||
{
|
||||
// Arrange
|
||||
@@ -179,7 +187,8 @@ public sealed class EndpointDiscoveryServiceTests
|
||||
result.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void DiscoverEndpoints_CanBeCalledMultipleTimes()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
Reference in New Issue
Block a user