public override bool Equals(object obj) { AddressMapping that = obj as AddressMapping; return(((that != null) && object.Equals(this.IpAddr, that.IpAddr)) && object.Equals(this.EthAddr, that.EthAddr)); }
public override void Define() { IpSourceEndpoint ipSrc = null; AddressMapping mapping = null; When() .Match(() => ipSrc, x => LanRulesHelper.IsLinkLocal(x.IpAddr)) .Match(() => mapping, m => m.IpAddr == ipSrc.IpAddr); Then() .Yield(_ => new LinkLocalIpAddressUse { IpAddress = ipSrc.IpAddr, EthAddress = mapping.EthAddr }); }
public override void Define() { IpSourceEndpoint ipSrc = null; AddressMapping mapping = null; When() .Match(() => ipSrc) .Match(() => mapping, m => m.IpAddr == ipSrc.IpAddr) .Exists <ArpUnanswered>(x => x.Request.EthSrc == mapping.EthAddr) .Not <IpDestinationEndpoint>(d => ipSrc.IpAddr == d.IpAddr); Then() .Yield(_ => new IpAddressMismatch { IpAddress = ipSrc.IpAddr, EthAddress = mapping.EthAddr }); }
public override void Define() { AddressMapping mapping = null; IEnumerable <AddressMapping> conflicts = null; When() .Match(() => mapping) .Query(() => conflicts, c => c.Match <AddressMapping>( m => mapping.IpAddr == m.IpAddr, m => mapping.EthAddr != m.EthAddr) .Collect() .Where(x => x.Any())); Then() .Yield(_ => new DuplicateAddressDetected { IpAddress = mapping.IpAddr, EthAddresses = conflicts.Select(c => c.EthAddr).ToArray() }); }