Commit 396ff745 authored by Brickner_cp's avatar Brickner_cp

Default IgmpReportVersion3Layer's 0 GroupRecords.

Fixed tests.
Code Coverage 97.81%
parent e94f56bb
......@@ -132,7 +132,7 @@ namespace PcapDotNet.Core.Test
// Wait for more packets
TestReceivePackets(NumPacketsToSend, 0, int.MaxValue, 2, PacketSize, PacketCommunicatorReceiveResult.None, NumPacketsToSend, 2, 2.043);
TestReceivePackets(NumPacketsToSend, -1, int.MaxValue, 2, PacketSize, PacketCommunicatorReceiveResult.None, NumPacketsToSend, 2, 2.3);
TestReceivePackets(NumPacketsToSend, NumPacketsToSend + 1, int.MaxValue, 2, PacketSize, PacketCommunicatorReceiveResult.None, NumPacketsToSend, 2, 2.035);
TestReceivePackets(NumPacketsToSend, NumPacketsToSend + 1, int.MaxValue, 2, PacketSize, PacketCommunicatorReceiveResult.None, NumPacketsToSend, 2, 2.051);
// Break loop
TestReceivePackets(NumPacketsToSend, NumPacketsToSend, 0, 2, PacketSize, PacketCommunicatorReceiveResult.BreakLoop, 0, 0, 0.027);
......
......@@ -181,7 +181,7 @@ namespace PcapDotNet.Core.Test
}
else
{
const byte retryNumber = 121;
const byte retryNumber = 28;
pcapFilename = Path.GetTempPath() + "temp." + retryNumber + ".pcap";
List<Packet> packetsList = new List<Packet>();
new OfflinePacketDevice(pcapFilename).Open().ReceivePackets(1000, packetsList.Add);
......@@ -221,7 +221,14 @@ namespace PcapDotNet.Core.Test
? b
: Math.Max((byte)0x20, Math.Min(b, (byte)0x7F))).ToArray());
Compare(XDocument.Load(fixedDocumentFilename), packets);
try
{
Compare(XDocument.Load(fixedDocumentFilename), packets);
}
catch (AssertFailedException exception)
{
throw new AssertFailedException("Failed comparing packets in file " + pcapFilename + ". Message: " + exception.Message, exception);
}
}
private static void Compare(XDocument document, IEnumerable<Packet> packets)
......@@ -232,7 +239,7 @@ namespace PcapDotNet.Core.Test
int i = 1;
foreach (var documentPacket in document.Element("pdml").Elements("packet"))
{
Console.WriteLine("Checking packet " + i);
// Console.WriteLine("Checking packet " + i);
packetEnumerator.MoveNext();
Packet packet = packetEnumerator.Current;
......@@ -612,8 +619,10 @@ namespace PcapDotNet.Core.Test
switch (field.Name())
{
case "igmp.version":
if (field.Show() != "0")
field.AssertShowDecimal(igmpDatagram.Version);
if (field.Show() == "0")
return;
field.AssertShowDecimal(igmpDatagram.Version);
break;
case "igmp.type":
......
......@@ -13,6 +13,13 @@ namespace PcapDotNet.Packets.Igmp
/// </summary>
public class IgmpReportVersion3Layer : IgmpLayer
{
/// <summary>
/// Creates an instance of an IGMP Report Version 3 Layer with a default of no Group Records.
/// </summary>
public IgmpReportVersion3Layer()
{
GroupRecords = new IgmpGroupRecord[0].AsReadOnly();
}
/// <summary>
/// Each Group Record is a block of fields containing information pertaining to the sender's membership in a single multicast group on the interface from which the Report is sent.
/// </summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment