Refactor IPAM model classes to use records for Address, Subnetwork, Vlan, Vrf, Section, Tag, Domain, Nameserver, and Session; enhance documentation and implement value equality for records.
This commit is contained in:
@@ -21,60 +21,60 @@ public class SessionManagerTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestSession_WhenNoSession_ReturnsNoToken()
|
||||
public void GetSessionStatus_WhenNoSession_ReturnsNoSession()
|
||||
{
|
||||
// Arrange
|
||||
SessionManager.CurrentSession = null;
|
||||
|
||||
// Act
|
||||
var result = SessionManager.TestSession();
|
||||
var result = SessionManager.GetSessionStatus();
|
||||
|
||||
// Assert
|
||||
result.Should().Be("NoToken");
|
||||
result.Should().Be(SessionStatus.NoSession);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestSession_WhenSessionWithNullExpires_ReturnsValid()
|
||||
public void GetSessionStatus_WhenSessionWithNullExpires_ReturnsValid()
|
||||
{
|
||||
// Arrange
|
||||
var session = new Session(AuthType.token, "test-token", "app", "https://test.com", null, null);
|
||||
var session = new Session(AuthType.Token, "test-token", "app", "https://test.com", null, null);
|
||||
SessionManager.CurrentSession = session;
|
||||
|
||||
// Act
|
||||
var result = SessionManager.TestSession();
|
||||
var result = SessionManager.GetSessionStatus();
|
||||
|
||||
// Assert
|
||||
result.Should().Be("Valid");
|
||||
result.Should().Be(SessionStatus.Valid);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestSession_WhenSessionNotExpired_ReturnsValid()
|
||||
public void GetSessionStatus_WhenSessionNotExpired_ReturnsValid()
|
||||
{
|
||||
// Arrange
|
||||
var futureExpiry = DateTime.Now.AddHours(1);
|
||||
var session = new Session(AuthType.credentials, "test-token", "app", "https://test.com", futureExpiry, null);
|
||||
var session = new Session(AuthType.Credentials, "test-token", "app", "https://test.com", futureExpiry, null);
|
||||
SessionManager.CurrentSession = session;
|
||||
|
||||
// Act
|
||||
var result = SessionManager.TestSession();
|
||||
var result = SessionManager.GetSessionStatus();
|
||||
|
||||
// Assert
|
||||
result.Should().Be("Valid");
|
||||
result.Should().Be(SessionStatus.Valid);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestSession_WhenSessionExpired_ReturnsExpired()
|
||||
public void GetSessionStatus_WhenSessionExpired_ReturnsExpired()
|
||||
{
|
||||
// Arrange
|
||||
var pastExpiry = DateTime.Now.AddHours(-1);
|
||||
var session = new Session(AuthType.credentials, "test-token", "app", "https://test.com", pastExpiry, null);
|
||||
var session = new Session(AuthType.Credentials, "test-token", "app", "https://test.com", pastExpiry, null);
|
||||
SessionManager.CurrentSession = session;
|
||||
|
||||
// Act
|
||||
var result = SessionManager.TestSession();
|
||||
var result = SessionManager.GetSessionStatus();
|
||||
|
||||
// Assert
|
||||
result.Should().Be("Expired");
|
||||
result.Should().Be(SessionStatus.Expired);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -93,7 +93,7 @@ public class SessionManagerTests : IDisposable
|
||||
session.URL.Should().Be(url);
|
||||
session.AppID.Should().Be(appId);
|
||||
session.Token.Should().Be(token);
|
||||
session.AuthType.Should().Be(AuthType.token);
|
||||
session.AuthType.Should().Be(AuthType.Token);
|
||||
session.Expires.Should().BeNull();
|
||||
session.Credentials.Should().BeNull();
|
||||
}
|
||||
@@ -144,7 +144,7 @@ public class SessionManagerTests : IDisposable
|
||||
public void CurrentSession_CanBeSetDirectly()
|
||||
{
|
||||
// Arrange
|
||||
var session = new Session(AuthType.token, "token", "app", "https://test.com", null, null);
|
||||
var session = new Session(AuthType.Token, "token", "app", "https://test.com", null, null);
|
||||
|
||||
// Act
|
||||
SessionManager.CurrentSession = session;
|
||||
|
||||
Reference in New Issue
Block a user