public void Test_PpiAggregation_Construction() { PpiAggregation field = new PpiAggregation(22); Assert.AreEqual(22, field.InterfaceId); PpiAggregation recreatedField = new PpiAggregation(new BinaryReader(new MemoryStream(field.Bytes))); Assert.AreEqual(22, recreatedField.InterfaceId); }
public void Test_PpiAggregation_Construction() { PpiAggregation field = new PpiAggregation(22); Assert.AreEqual(22, field.InterfaceId); PpiAggregation recreatedField = new PpiAggregation(new BinaryReader(new MemoryStream(field.Bytes))); Assert.AreEqual(22, recreatedField.InterfaceId); }
public void ConstructPacketWithMultipleAlignedFields() { PpiPacket packet = new PpiPacket(); packet.Flags |= PpiPacket.HeaderFlags.Alignment32Bit; PpiCommon commonField = new PpiCommon(); commonField.ChannelFrequency = 2142; commonField.AntennaSignalPower = 50; commonField.AntennaSignalNoise = 25; packet.Add(commonField); Assert.AreEqual(32, packet.Length); PpiProcessInfo processInfoField = new PpiProcessInfo(); processInfoField.UserId = 0x1111; processInfoField.UserName = "******"; processInfoField.GroupId = 0x2222; processInfoField.GroupName = "Test Group"; packet.Add(processInfoField); Assert.AreEqual(84, packet.Length); PpiAggregation aggregationField = new PpiAggregation(0x3333); packet.Add(aggregationField); Assert.AreEqual(92, packet.Length); PpiPacket recreatedPacket = Packet.ParsePacket(LinkLayers.PerPacketInformation, packet.Bytes) as PpiPacket; PpiCommon recreatedCommonField = recreatedPacket[0] as PpiCommon; Assert.IsNotNull(recreatedCommonField); Assert.AreEqual(2142, recreatedCommonField.ChannelFrequency); Assert.AreEqual(50, recreatedCommonField.AntennaSignalPower); Assert.AreEqual(25, recreatedCommonField.AntennaSignalNoise); PpiProcessInfo recreatedProcessField = recreatedPacket[1] as PpiProcessInfo; Assert.IsNotNull(recreatedProcessField); Assert.AreEqual(0x1111, recreatedProcessField.UserId); Assert.AreEqual("Hester the tester", recreatedProcessField.UserName); Assert.AreEqual(0x2222, recreatedProcessField.GroupId); Assert.AreEqual("Test Group", recreatedProcessField.GroupName); PpiAggregation recreatedAggregationField = recreatedPacket[2] as PpiAggregation; Assert.IsNotNull(recreatedAggregationField); Assert.AreEqual(0x3333, recreatedAggregationField.InterfaceId); }
public void ConstructPacketWithMultipleFields() { var packet = new PpiPacket(); var commonField = new PpiCommon { ChannelFrequency = 2142, AntennaSignalPower = 50, AntennaSignalNoise = 25 }; packet.Add(commonField); Assert.AreEqual(32, packet.Length); var processInfoField = new PpiProcessInfo { UserId = 0x1111, UserName = "******", GroupId = 0x2222, GroupName = "Test Group" }; packet.Add(processInfoField); Assert.AreEqual(82, packet.Length); var aggregationField = new PpiAggregation(0x3333); packet.Add(aggregationField); Assert.AreEqual(90, packet.Length); var recreatedPacket = Packet.ParsePacket(LinkLayers.Ppi, packet.Bytes) as PpiPacket; var recreatedCommonField = recreatedPacket[0] as PpiCommon; Assert.IsNotNull(recreatedCommonField); Assert.AreEqual(2142, recreatedCommonField.ChannelFrequency); Assert.AreEqual(50, recreatedCommonField.AntennaSignalPower); Assert.AreEqual(25, recreatedCommonField.AntennaSignalNoise); var recreatedProcessField = recreatedPacket[1] as PpiProcessInfo; Assert.IsNotNull(recreatedProcessField); Assert.AreEqual(0x1111, recreatedProcessField.UserId); Assert.AreEqual("Hester the tester", recreatedProcessField.UserName); Assert.AreEqual(0x2222, recreatedProcessField.GroupId); Assert.AreEqual("Test Group", recreatedProcessField.GroupName); var recreatedAggregationField = recreatedPacket[2] as PpiAggregation; Assert.IsNotNull(recreatedAggregationField); Assert.AreEqual(0x3333, recreatedAggregationField.InterfaceId); }
public void ConstructPacketWithMultipleAlignedFields() { PpiPacket packet = new PpiPacket(); packet.Flags |= PpiPacket.HeaderFlags.Alignment32Bit; PpiCommon commonField = new PpiCommon(); commonField.ChannelFrequency = 2142; commonField.AntennaSignalPower = 50; commonField.AntennaSignalNoise = 25; packet.Add(commonField); Assert.AreEqual(32, packet.Length); PpiProcessInfo processInfoField = new PpiProcessInfo(); processInfoField.UserId = 0x1111; processInfoField.UserName = "******"; processInfoField.GroupId = 0x2222; processInfoField.GroupName = "Test Group"; packet.Add(processInfoField); Assert.AreEqual(84, packet.Length); PpiAggregation aggregationField = new PpiAggregation(0x3333); packet.Add(aggregationField); Assert.AreEqual(92, packet.Length); PpiPacket recreatedPacket = Packet.ParsePacket(LinkLayers.PerPacketInformation, packet.Bytes) as PpiPacket; PpiCommon recreatedCommonField = recreatedPacket[0] as PpiCommon; Assert.IsNotNull(recreatedCommonField); Assert.AreEqual(2142, recreatedCommonField.ChannelFrequency); Assert.AreEqual(50, recreatedCommonField.AntennaSignalPower); Assert.AreEqual(25, recreatedCommonField.AntennaSignalNoise); PpiProcessInfo recreatedProcessField = recreatedPacket[1] as PpiProcessInfo; Assert.IsNotNull(recreatedProcessField); Assert.AreEqual(0x1111, recreatedProcessField.UserId); Assert.AreEqual("Hester the tester", recreatedProcessField.UserName); Assert.AreEqual(0x2222, recreatedProcessField.GroupId); Assert.AreEqual("Test Group", recreatedProcessField.GroupName); PpiAggregation recreatedAggregationField = recreatedPacket[2] as PpiAggregation; Assert.IsNotNull(recreatedAggregationField); Assert.AreEqual(0x3333, recreatedAggregationField.InterfaceId); }