Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pcap-Net
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Pcap-Net
Commits
a1f5d127
Commit
a1f5d127
authored
Nov 28, 2015
by
Boaz Brickner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More detailed exceptions for Wireshark compare tests.
parent
d103f0f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
9 deletions
+31
-9
WiresharkCompareTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
+31
-9
No files found.
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
View file @
a1f5d127
...
...
@@ -82,13 +82,35 @@ namespace PcapDotNet.Core.Test
Console
.
WriteLine
(
"Seed: "
+
seed
);
Random
random
=
new
Random
(
seed
);
for
(
int
i
=
0
;
i
!=
10
;
++
i
)
try
{
// Create packets
List
<
Packet
>
packets
=
new
List
<
Packet
>(
CreateRandomPackets
(
random
,
200
));
// Compare packets to wireshark
ComparePacketsToWireshark
(
packets
);
for
(
int
i
=
0
;
i
!=
10
;
++
i
)
{
List
<
Packet
>
packets
;
try
{
// Create packets
packets
=
new
List
<
Packet
>(
CreateRandomPackets
(
random
,
200
));
}
catch
(
Exception
exception
)
{
throw
new
AssertFailedException
(
"Failed creating packets. "
+
exception
,
exception
);
}
try
{
// Compare packets to wireshark
ComparePacketsToWireshark
(
packets
);
}
catch
(
Exception
exception
)
{
throw
new
AssertFailedException
(
"Failed comparing packets. "
+
exception
,
exception
);
}
}
}
catch
(
Exception
exception
)
{
throw
new
AssertFailedException
(
"Failed test with seed "
+
seed
+
". "
+
exception
,
exception
);
}
}
...
...
@@ -102,7 +124,7 @@ namespace PcapDotNet.Core.Test
Packet
packet
=
new
Packet
(
new
byte
[
14
],
timestamp
,
DataLinkKind
.
Ethernet
);
// Compare packet to wireshark
ComparePacketsToWireshark
(
new
[]
{
packet
}
);
ComparePacketsToWireshark
(
packet
);
// BUG: Limited timestamp due to Windows bug: https://connect.microsoft.com/VisualStudio/feedback/details/559198/net-4-datetime-tolocaltime-is-sometimes-wrong
// Now check different dates.
...
...
@@ -495,9 +517,9 @@ namespace PcapDotNet.Core.Test
{
Compare
(
XDocument
.
Load
(
fixedDocumentFilename
,
LoadOptions
.
None
),
packets
);
}
catch
(
AssertFailed
Exception
exception
)
catch
(
Exception
exception
)
{
throw
new
AssertFailedException
(
"Failed comparing packets in file "
+
pcapFilename
+
".
Message: "
+
exception
.
Message
,
exception
);
throw
new
AssertFailedException
(
"Failed comparing packets in file "
+
pcapFilename
+
".
"
+
exception
,
exception
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment