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
647277c1
Commit
647277c1
authored
Aug 09, 2009
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed tests.
parent
71506133
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
LivePacketDeviceTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/LivePacketDeviceTests.cs
+13
-6
WiresharkCompareTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
+1
-1
No files found.
PcapDotNet/src/PcapDotNet.Core.Test/LivePacketDeviceTests.cs
View file @
647277c1
...
@@ -340,11 +340,12 @@ namespace PcapDotNet.Core.Test
...
@@ -340,11 +340,12 @@ namespace PcapDotNet.Core.Test
using
(
PacketCommunicator
communicator
=
OpenLiveDevice
())
using
(
PacketCommunicator
communicator
=
OpenLiveDevice
())
{
{
communicator
.
SetFilter
(
"ether src "
+
SourceMac
+
" and ether dst "
+
DestinationMac
);
communicator
.
SetFilter
(
"ether src "
+
SourceMac
+
" and ether dst "
+
DestinationMac
);
communicator
.
SetKernelBufferSize
(
5
0
);
communicator
.
SetKernelBufferSize
(
1
0
);
Packet
packet
=
_random
.
NextEthernetPacket
(
100
,
SourceMac
,
DestinationMac
);
Packet
packet
=
_random
.
NextEthernetPacket
(
100
,
SourceMac
,
DestinationMac
);
communicator
.
SendPacket
(
packet
);
communicator
.
SendPacket
(
packet
);
communicator
.
ReceivePacket
(
out
packet
);
communicator
.
ReceivePacket
(
out
packet
);
}
}
Assert
.
Fail
();
}
}
[
TestMethod
]
[
TestMethod
]
...
@@ -357,12 +358,13 @@ namespace PcapDotNet.Core.Test
...
@@ -357,12 +358,13 @@ namespace PcapDotNet.Core.Test
using
(
PacketCommunicator
communicator
=
OpenLiveDevice
())
using
(
PacketCommunicator
communicator
=
OpenLiveDevice
())
{
{
communicator
.
SetFilter
(
"ether src "
+
SourceMac
+
" and ether dst "
+
DestinationMac
);
communicator
.
SetFilter
(
"ether src "
+
SourceMac
+
" and ether dst "
+
DestinationMac
);
communicator
.
SetKernelBufferSize
(
5
0
);
communicator
.
SetKernelBufferSize
(
1
0
);
Packet
packet
=
_random
.
NextEthernetPacket
(
100
,
SourceMac
,
DestinationMac
);
Packet
packet
=
_random
.
NextEthernetPacket
(
100
,
SourceMac
,
DestinationMac
);
communicator
.
SendPacket
(
packet
);
communicator
.
SendPacket
(
packet
);
int
numPacketsGot
;
int
numPacketsGot
;
communicator
.
ReceiveSomePackets
(
out
numPacketsGot
,
1
,
delegate
{
});
communicator
.
ReceiveSomePackets
(
out
numPacketsGot
,
1
,
delegate
{
});
}
}
Assert
.
Fail
();
}
}
[
TestMethod
]
[
TestMethod
]
...
@@ -375,7 +377,7 @@ namespace PcapDotNet.Core.Test
...
@@ -375,7 +377,7 @@ namespace PcapDotNet.Core.Test
using
(
PacketCommunicator
communicator
=
OpenLiveDevice
())
using
(
PacketCommunicator
communicator
=
OpenLiveDevice
())
{
{
communicator
.
SetFilter
(
"ether src "
+
SourceMac
+
" and ether dst "
+
DestinationMac
);
communicator
.
SetFilter
(
"ether src "
+
SourceMac
+
" and ether dst "
+
DestinationMac
);
communicator
.
SetKernelBufferSize
(
5
0
);
communicator
.
SetKernelBufferSize
(
1
0
);
Packet
packet
=
_random
.
NextEthernetPacket
(
100
,
SourceMac
,
DestinationMac
);
Packet
packet
=
_random
.
NextEthernetPacket
(
100
,
SourceMac
,
DestinationMac
);
communicator
.
SendPacket
(
packet
);
communicator
.
SendPacket
(
packet
);
Exception
exception
=
null
;
Exception
exception
=
null
;
...
@@ -397,6 +399,8 @@ namespace PcapDotNet.Core.Test
...
@@ -397,6 +399,8 @@ namespace PcapDotNet.Core.Test
if
(
exception
!=
null
)
if
(
exception
!=
null
)
throw
exception
;
throw
exception
;
}
}
Assert
.
Fail
();
}
}
[
TestMethod
]
[
TestMethod
]
...
@@ -406,10 +410,12 @@ namespace PcapDotNet.Core.Test
...
@@ -406,10 +410,12 @@ namespace PcapDotNet.Core.Test
using
(
PacketCommunicator
communicator
=
OpenLiveDevice
())
using
(
PacketCommunicator
communicator
=
OpenLiveDevice
())
{
{
communicator
.
Mode
=
PacketCommunicatorMode
.
Statistics
;
communicator
.
Mode
=
PacketCommunicatorMode
.
Statistics
;
communicator
.
SetKernelBufferSize
(
5
0
);
communicator
.
SetKernelBufferSize
(
1
0
);
PacketSampleStatistics
statistics
;
PacketSampleStatistics
statistics
;
communicator
.
ReceiveStatistics
(
out
statistics
);
communicator
.
ReceiveStatistics
(
out
statistics
);
}
}
Assert
.
Fail
();
}
}
[
TestMethod
]
[
TestMethod
]
...
@@ -419,9 +425,10 @@ namespace PcapDotNet.Core.Test
...
@@ -419,9 +425,10 @@ namespace PcapDotNet.Core.Test
using
(
PacketCommunicator
communicator
=
OpenLiveDevice
())
using
(
PacketCommunicator
communicator
=
OpenLiveDevice
())
{
{
communicator
.
Mode
=
PacketCommunicatorMode
.
Statistics
;
communicator
.
Mode
=
PacketCommunicatorMode
.
Statistics
;
communicator
.
SetKernelBufferSize
(
5
0
);
communicator
.
SetKernelBufferSize
(
1
0
);
communicator
.
ReceiveStatistics
(
1
,
delegate
{
});
communicator
.
ReceiveStatistics
(
1
,
delegate
{
Assert
.
Fail
();
});
}
}
Assert
.
Fail
();
}
}
[
TestMethod
]
[
TestMethod
]
...
...
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
View file @
647277c1
...
@@ -76,7 +76,7 @@ namespace PcapDotNet.Core.Test
...
@@ -76,7 +76,7 @@ namespace PcapDotNet.Core.Test
[
TestMethod
]
[
TestMethod
]
public
void
ComparePacketsToWiresharkTest
()
public
void
ComparePacketsToWiresharkTest
()
{
{
for
(
int
i
=
0
;
i
!=
10
0
;
++
i
)
for
(
int
i
=
0
;
i
!=
10
;
++
i
)
{
{
// Create packets
// Create packets
List
<
Packet
>
packets
=
new
List
<
Packet
>(
CreateRandomPackets
(
100
));
List
<
Packet
>
packets
=
new
List
<
Packet
>(
CreateRandomPackets
(
100
));
...
...
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