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:
@@ -26,28 +26,13 @@ public class TagTests
|
||||
tag.Id.Should().Be(id);
|
||||
tag.Type.Should().Be(type);
|
||||
tag.ShowTag.Should().Be(showTag);
|
||||
tag.BGColor.Should().Be(bgColor);
|
||||
tag.FGColor.Should().Be(fgColor);
|
||||
tag.Compress.Should().BeTrue();
|
||||
tag.Locked.Should().BeFalse();
|
||||
tag.BackgroundColor.Should().Be(bgColor);
|
||||
tag.ForegroundColor.Should().Be(fgColor);
|
||||
tag.Compress.Should().Be(compress);
|
||||
tag.Locked.Should().Be(locked);
|
||||
tag.UpdateTag.Should().Be(updateTag);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Yes", true)]
|
||||
[InlineData("No", false)]
|
||||
[InlineData("", false)]
|
||||
[InlineData("yes", false)] // Case sensitive
|
||||
[InlineData("true", false)] // Only "Yes" is true
|
||||
public void StringToBool_ConvertsCorrectly(string input, bool expected)
|
||||
{
|
||||
// The StringToBool is private, so we test through the constructor
|
||||
// Using Compress field which uses StringToBool
|
||||
var tag = new Tag(1, "Test", false, "", "", input, "No", false);
|
||||
|
||||
tag.Compress.Should().Be(expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Used")]
|
||||
[InlineData("Available")]
|
||||
@@ -66,12 +51,13 @@ public class TagTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Locked_WithYes_IsTrue()
|
||||
public void Record_Equality_WorksCorrectly()
|
||||
{
|
||||
// Arrange & Act
|
||||
var tag = new Tag(1, "Test", false, "", "", "No", "Yes", false);
|
||||
// Arrange
|
||||
var tag1 = new Tag(1, "Used", true, "#fff", "#000", "Yes", "No", false);
|
||||
var tag2 = new Tag(1, "Used", true, "#fff", "#000", "Yes", "No", false);
|
||||
|
||||
// Assert
|
||||
tag.Locked.Should().BeTrue();
|
||||
tag1.Should().Be(tag2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user