Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -2,11 +2,13 @@ using StellaOps.Microservice;
|
||||
using StellaOps.Router.Common.Enums;
|
||||
using Xunit;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Microservice.Tests;
|
||||
|
||||
public class StellaMicroserviceOptionsTests
|
||||
{
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void StellaMicroserviceOptions_CanBeCreated()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -24,7 +26,8 @@ public class StellaMicroserviceOptionsTests
|
||||
Assert.NotEmpty(options.InstanceId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void RouterEndpointConfig_CanBeCreated()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -41,7 +44,8 @@ public class StellaMicroserviceOptionsTests
|
||||
Assert.Equal(TransportType.Tcp, config.TransportType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Validate_ThrowsIfServiceNameEmpty()
|
||||
{
|
||||
// Arrange
|
||||
@@ -56,7 +60,8 @@ public class StellaMicroserviceOptionsTests
|
||||
Assert.Throws<InvalidOperationException>(() => options.Validate());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Validate_ThrowsIfVersionInvalid()
|
||||
{
|
||||
// Arrange
|
||||
@@ -72,7 +77,8 @@ public class StellaMicroserviceOptionsTests
|
||||
Assert.Contains("not valid semver", ex.Message);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Validate_ThrowsIfNoRouters()
|
||||
{
|
||||
// Arrange
|
||||
@@ -88,7 +94,8 @@ public class StellaMicroserviceOptionsTests
|
||||
Assert.Contains("router endpoint is required", ex.Message);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Validate_AcceptsValidSemver()
|
||||
{
|
||||
// Arrange
|
||||
@@ -104,7 +111,8 @@ public class StellaMicroserviceOptionsTests
|
||||
options.Validate();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Validate_AcceptsSemverWithPrerelease()
|
||||
{
|
||||
// Arrange
|
||||
@@ -120,7 +128,8 @@ public class StellaMicroserviceOptionsTests
|
||||
options.Validate();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void DefaultHeartbeatInterval_Is10Seconds()
|
||||
{
|
||||
// Arrange & Act
|
||||
|
||||
Reference in New Issue
Block a user