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
b6098579
Commit
b6098579
authored
Apr 27, 2012
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code coverage 95.84%
parent
7a3ec961
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
IpV4Tests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IpV4Tests.cs
+27
-0
No files found.
PcapDotNet/src/PcapDotNet.Packets.Test/IpV4Tests.cs
View file @
b6098579
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.IpV4
;
...
...
@@ -158,6 +160,31 @@ namespace PcapDotNet.Packets.Test
}
}
[
TestMethod
]
public
void
IpV4NullOptionsTest
()
{
Packet
packet
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
new
IpV4Layer
{
CurrentDestination
=
new
IpV4Address
(
"2.3.4.5"
),
Options
=
new
IpV4Options
(
new
IpV4OptionStrictSourceRouting
(
new
[]
{
new
IpV4Address
(
"1.2.3.4"
)},
0
)),
Protocol
=
IpV4Protocol
.
Emcon
,
});
Assert
.
IsTrue
(
packet
.
IsValid
);
Assert
.
IsNotNull
(
packet
.
IpV4
.
Options
);
Assert
.
AreEqual
(
new
IpV4Address
(
"1.2.3.4"
),
packet
.
IpV4
.
Destination
);
const
int
newPacketLength
=
IpV4Datagram
.
HeaderMinimumLength
-
1
;
byte
[]
newPacketBuffer
=
new
byte
[
newPacketLength
];
packet
.
Take
(
newPacketLength
).
ToArray
().
CopyTo
(
newPacketBuffer
,
0
);
Packet
newPacket
=
new
Packet
(
newPacketBuffer
,
DateTime
.
Now
,
DataLinkKind
.
IpV4
);
Assert
.
IsFalse
(
newPacket
.
IsValid
);
Assert
.
IsNull
(
newPacket
.
IpV4
.
Options
);
Assert
.
AreNotEqual
(
new
IpV4Address
(
"1.2.3.4"
),
newPacket
.
IpV4
.
Destination
);
}
[
TestMethod
]
[
ExpectedException
(
typeof
(
ArgumentOutOfRangeException
),
AllowDerivedTypes
=
false
)]
public
void
IpV4OptionTimestampOverflowErrorTest
()
...
...
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