public void TestValidDataLinks() { PcapDataLink dataLink = new PcapDataLink(); Assert.AreEqual(new PcapDataLink("NULL"), dataLink); string previousDataLinkName = null; for (int i = 0; i != 1000; ++i) { dataLink = new PcapDataLink(i); string dataLinkName; try { dataLinkName = dataLink.Name; } catch (InvalidOperationException) { // Ignore invalid values continue; } Assert.AreEqual(new PcapDataLink(dataLinkName), dataLink); Assert.IsFalse(dataLink.Equals(null)); Assert.IsTrue(new PcapDataLink(dataLinkName) == dataLink); Assert.IsFalse(new PcapDataLink(dataLinkName) != dataLink); Assert.IsTrue(previousDataLinkName == null || new PcapDataLink(previousDataLinkName) != dataLink); Assert.IsNotNull(dataLink.Description); Assert.AreEqual(i, dataLink.Value); Assert.AreEqual(dataLink.Value.GetHashCode(), dataLink.GetHashCode()); previousDataLinkName = dataLinkName; } }
public void NoDescriptionErrorTest() { PcapDataLink dataLink = GetInvalidDataLink(); Assert.IsNotNull(dataLink.Description); Assert.Fail(); }
public void InvalidNameErrorTest() { PcapDataLink dataLink = new PcapDataLink("Invalid Name"); Assert.IsNotNull(dataLink); Assert.Fail(); }
public void InvalidKindTest() { const DataLinkKind InvalidKind = (DataLinkKind)100; IDataLink dataLink = new PcapDataLink(InvalidKind); Assert.IsNotNull(dataLink); Assert.Fail(); }
private static PcapDataLink GetInvalidDataLink() { for (int i = 0; i != 1000; ++i) { PcapDataLink dataLink = new PcapDataLink(i); try { string dataLinkName = dataLink.Name; Assert.IsNotNull(dataLinkName); } catch (InvalidOperationException) { return(dataLink); } catch (Exception) { Assert.Fail(); } } Assert.Fail(); return(new PcapDataLink()); }
public PacketHandler(HandlePacket callback, PcapDataLink dataLink) { this._callback = callback; this._dataLink = dataLink; }
public void UnsupportedKindErrorTest() { PcapDataLink dataLink = new PcapDataLink(); Assert.IsNotNull(dataLink.Kind); }
private static PcapDataLink GetInvalidDataLink() { for (int i = 0; i != 1000; ++i) { PcapDataLink dataLink = new PcapDataLink(i); try { string dataLinkName = dataLink.Name; Assert.IsNotNull(dataLinkName); } catch (InvalidOperationException) { return dataLink; } catch (Exception) { Assert.Fail(); } } Assert.Fail(); return new PcapDataLink(); }