mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
[Hosts] Improved duplicate hosts finding (#24294)
* improved duplicate hosts finding * improved filters with AdvancedCollectionView * cancel FindDuplicates when file is reloaded
This commit is contained in:
committed by
GitHub
parent
0d9b797ef0
commit
3e651b8de6
@@ -28,7 +28,7 @@ namespace Hosts.Tests
|
||||
[DataRow("# # \t10.1.1.1 host#comment", "10.1.1.1", "host", "comment", false)]
|
||||
public void Valid_Entry_SingleHost(string line, string address, string host, string comment, bool active)
|
||||
{
|
||||
var entry = new Entry(line);
|
||||
var entry = new Entry(0, line);
|
||||
|
||||
Assert.AreEqual(entry.Address, address);
|
||||
Assert.AreEqual(entry.Hosts, host);
|
||||
@@ -52,7 +52,7 @@ namespace Hosts.Tests
|
||||
[DataRow("#10.1.1.1 host host.local#comment", "10.1.1.1", "host host.local", "comment", false)]
|
||||
public void Valid_Entry_MultipleHosts(string line, string address, string host, string comment, bool active)
|
||||
{
|
||||
var entry = new Entry(line);
|
||||
var entry = new Entry(0, line);
|
||||
|
||||
Assert.AreEqual(entry.Address, address);
|
||||
Assert.AreEqual(entry.Hosts, host);
|
||||
@@ -76,7 +76,7 @@ namespace Hosts.Tests
|
||||
[DataRow("host 10.1.1.1")]
|
||||
public void Not_Valid_Entry(string line)
|
||||
{
|
||||
var entry = new Entry(line);
|
||||
var entry = new Entry(0, line);
|
||||
Assert.IsFalse(entry.Valid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Hosts.Tests
|
||||
fileSystem.AddFile(service.HostsFilePath, new MockFileData(content));
|
||||
|
||||
var (_, entries) = await service.ReadAsync();
|
||||
entries.Add(new Entry("10.1.1.30", "host30 host30.local", "new entry", false));
|
||||
entries.Add(new Entry(0, "10.1.1.30", "host30 host30.local", "new entry", false));
|
||||
await service.WriteAsync(string.Empty, entries);
|
||||
|
||||
var result = fileSystem.GetFile(service.HostsFilePath);
|
||||
|
||||
Reference in New Issue
Block a user