Files
dnsmasq-webui/src/DnsmasqWebUI.Tests/Models/Dhcp/DhcpRangeDraftTests.cs
T
alex b24ca17779 Add structured DNS, DHCP, and resolver policy editing flows.
Unify the pages around the effective-config save workflow, source-aware projections, and hosts-style table UX so draft changes are easier to understand and the specialized editors stay consistent and better covered by tests.
2026-04-11 20:25:28 +10:00

34 lines
898 B
C#

using DnsmasqWebUI.Models.Dhcp;
namespace DnsmasqWebUI.Tests.Models.Dhcp;
public class DhcpRangeDraftTests
{
[Fact]
public void FromRaw_Structured_RoundTrips()
{
const string raw = "tag:guest,192.168.1.50,192.168.1.150,12h";
var d = DhcpRangeDraft.FromRaw(raw);
Assert.True(d.IsStructured);
Assert.Equal(raw, d.ToRaw());
}
[Fact]
public void FromRaw_Unparseable_UsesFallback()
{
const string raw = "not-a-valid-range";
var d = DhcpRangeDraft.FromRaw(raw);
Assert.False(d.IsStructured);
Assert.Equal(raw, d.ToRaw());
}
[Fact]
public void FromRaw_ConstructorIpv4Range_IsStructured()
{
const string raw = "192.168.1.50,192.168.1.150,255.255.255.0,12h";
var d = DhcpRangeDraft.FromRaw(raw);
Assert.True(d.IsStructured);
Assert.Equal(raw, d.ToRaw());
}
}