Ejemplo n.º 1
0
 internal virtual void AssertEquality(INetworkDetails expected, INetworkDetails actual)
 {
     Assert.AreEqual(expected.BroadcastAddress, actual.BroadcastAddress, "Should be equal");
     Assert.AreEqual(expected.NetworkAddress, actual.NetworkAddress, "Should be equal");
     Assert.AreEqual(expected.SubNetMask, actual.SubNetMask, "Should be equal");
     Assert.AreEqual(expected.UsableEndAddress, actual.UsableEndAddress, "Should be equal");
     Assert.AreEqual(expected.UsableStartAddress, actual.UsableStartAddress, "Should be equal");
     Assert.AreEqual(expected.MaxHosts, actual.MaxHosts, "Should be equal");
     Assert.AreEqual(expected.MaxUsableHosts, actual.MaxUsableHosts, "Should be equal");
 }
Ejemplo n.º 2
0
        public SpfResult VerifyIpMechanism(IPAddress sender, string ipSpfText)
        {
            if (ipSpfText.Contains("/"))
            {
                var             range   = ipSpfText.Split(':').Skip(1).FirstOrDefault();
                INetworkDetails details = Parser.ParseRange(range);

                if (details.IsInRange(sender))
                {
                    return(SpfResult.Pass);
                }
            }
            else
            {
                if (sender.Equals(IPAddress.Parse(ipSpfText.Split(':').Skip(1).FirstOrDefault())))
                {
                    return(SpfResult.Pass);
                }
            }

            return(SpfResult.Fail);
        }