From 537e79d3c8b99e1576db48b19c8071c0922342f2 Mon Sep 17 00:00:00 2001 From: chris_bednarski Date: Sun, 20 Aug 2023 19:49:21 +1000 Subject: use WcaGetRecordFormattedString to get firewall rule description --- src/test/burn/WixTestTools/Firewall/RuleDetails.cs | 4 ++-- src/test/burn/WixTestTools/Firewall/UniqueCheck.cs | 9 ++++++++- src/test/burn/WixTestTools/Firewall/Verifier.cs | 2 ++ 3 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src/test/burn') diff --git a/src/test/burn/WixTestTools/Firewall/RuleDetails.cs b/src/test/burn/WixTestTools/Firewall/RuleDetails.cs index 38a80bb8..d1e53de4 100644 --- a/src/test/burn/WixTestTools/Firewall/RuleDetails.cs +++ b/src/test/burn/WixTestTools/Firewall/RuleDetails.cs @@ -164,7 +164,7 @@ namespace WixTestTools.Firewall public bool? Enabled { get; set; } /// - /// This property is optional. It specifies the group to which an individual rule belongs and groups multiple rules into a single line in the Windows Firewall control panel
+ /// This property is optional. It specifies the group to which an individual rule belongs and groups multiple rules into a single line in the Windows Firewall control panel.
/// This allows the users to enable or disable multiple rules with a single click.
/// The Grouping property can also be specified using indirect strings.
/// Example: "Simple Group Name"
@@ -193,7 +193,7 @@ namespace WixTestTools.Firewall /// /// This property is optional. The NET_FW_ACTION enumerated type specifies the action for this rule.
- /// NET_FW_ACTION_ALLOW is the default value. Profiles can be combined from the following values:
+ /// NET_FW_ACTION_ALLOW is the default value. The Action must be specified from the following list of values:
/// o NET_FW_ACTION_BLOCK = 0x0
/// o NET_FW_ACTION_ALLOW = 0x1
///
diff --git a/src/test/burn/WixTestTools/Firewall/UniqueCheck.cs b/src/test/burn/WixTestTools/Firewall/UniqueCheck.cs index 83a1e57a..598350f9 100644 --- a/src/test/burn/WixTestTools/Firewall/UniqueCheck.cs +++ b/src/test/burn/WixTestTools/Firewall/UniqueCheck.cs @@ -6,7 +6,7 @@ namespace WixTestTools.Firewall /// /// A lot of firewall rules don't follow the Microsoft recommendation of using unique names.
- /// This class helps to disambiguate the rules based on Name, Direction, Profile, Protocol, ApplicationName and the LocalUserOwner. + /// This class helps to disambiguate the rules based on Name, Direction, Profile, Protocol, ApplicationName, LocalUserOwner and RemoteAddresses. ///
public class UniqueCheck { @@ -22,6 +22,7 @@ namespace WixTestTools.Firewall this.Protocol = details.Protocol; this.ApplicationName = details.ApplicationName; this.LocalUserOwner = details.LocalUserOwner; + this.RemoteAddresses = details.RemoteAddresses; } @@ -37,6 +38,7 @@ namespace WixTestTools.Firewall public string LocalUserOwner { get; set; } + public string RemoteAddresses { get; set; } public bool FirewallRuleIsUnique(INetFwRule3 rule) { @@ -70,6 +72,11 @@ namespace WixTestTools.Firewall return false; } + if (this.RemoteAddresses != null && rule.RemoteAddresses != this.RemoteAddresses) + { + return false; + } + return true; } } diff --git a/src/test/burn/WixTestTools/Firewall/Verifier.cs b/src/test/burn/WixTestTools/Firewall/Verifier.cs index d3f32c5c..c1bf3219 100644 --- a/src/test/burn/WixTestTools/Firewall/Verifier.cs +++ b/src/test/burn/WixTestTools/Firewall/Verifier.cs @@ -281,7 +281,9 @@ namespace WixTestTools.Firewall Assert.True(expected.ServiceName == actual.ServiceName, FormatErrorMessage(name, "ServiceNames", expected.ServiceName, actual.ServiceName, unique)); Assert.True(expected.Protocol == actual.Protocol, FormatErrorMessage(name, "Protocols", expected.Protocol, actual.Protocol, unique)); Assert.True(expected.LocalPorts == actual.LocalPorts, FormatErrorMessage(name, "LocalPorts", expected.LocalPorts, actual.LocalPorts, unique)); + Assert.True(expected.LocalAddresses == actual.LocalAddresses, FormatErrorMessage(name, "LocalAddresses", expected.LocalAddresses, actual.LocalAddresses, unique)); Assert.True(expected.RemotePorts == actual.RemotePorts, FormatErrorMessage(name, "RemotePorts", expected.RemotePorts, actual.RemotePorts, unique)); + Assert.True(expected.RemoteAddresses == actual.RemoteAddresses, FormatErrorMessage(name, "RemoteAddresses", expected.RemoteAddresses, actual.RemoteAddresses, unique)); Assert.True(expected.IcmpTypesAndCodes == actual.IcmpTypesAndCodes, FormatErrorMessage(name, "IcmpTypesAndCodes", expected.IcmpTypesAndCodes, actual.Description, unique)); Assert.True(expected.Direction == actual.Direction, FormatErrorMessage(name, "Directions", expected.Direction, actual.Direction, unique)); Assert.Equal(expected.Interfaces, actual.Interfaces); -- cgit v1.2.3-55-g6feb