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
62def0bc
Commit
62def0bc
authored
Mar 24, 2012
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code coverage 94.42%
parent
74bbb693
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
0 deletions
+48
-0
OfflinePacketDeviceTests.cs
...tNet/src/PcapDotNet.Core.Test/OfflinePacketDeviceTests.cs
+11
-0
DnsTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/DnsTests.cs
+37
-0
No files found.
PcapDotNet/src/PcapDotNet.Core.Test/OfflinePacketDeviceTests.cs
View file @
62def0bc
...
@@ -153,6 +153,17 @@ namespace PcapDotNet.Core.Test
...
@@ -153,6 +153,17 @@ namespace PcapDotNet.Core.Test
using
(
new
OfflinePacketDevice
(
"myinvalidfile"
).
Open
())
using
(
new
OfflinePacketDevice
(
"myinvalidfile"
).
Open
())
{
{
}
}
Assert
.
Fail
();
}
[
TestMethod
]
[
ExpectedException
(
typeof
(
InvalidOperationException
))]
public
void
OpenNullFilenameTest
()
{
using
(
new
OfflinePacketDevice
(
null
).
Open
())
{
}
Assert
.
Fail
();
}
}
[
TestMethod
]
[
TestMethod
]
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/DnsTests.cs
View file @
62def0bc
...
@@ -245,6 +245,7 @@ namespace PcapDotNet.Packets.Test
...
@@ -245,6 +245,7 @@ namespace PcapDotNet.Packets.Test
Assert
.
IsTrue
(
resourceData
.
IsTypePresentForOwner
(
DnsType
.
A
));
Assert
.
IsTrue
(
resourceData
.
IsTypePresentForOwner
(
DnsType
.
A
));
Assert
.
IsTrue
(
resourceData
.
IsTypePresentForOwner
(
DnsType
.
Aaaa
));
Assert
.
IsTrue
(
resourceData
.
IsTypePresentForOwner
(
DnsType
.
Aaaa
));
Assert
.
IsFalse
(
resourceData
.
IsTypePresentForOwner
(
DnsType
.
Ns
));
Assert
.
IsFalse
(
resourceData
.
IsTypePresentForOwner
(
DnsType
.
Ns
));
Assert
.
IsFalse
(
resourceData
.
IsTypePresentForOwner
(
DnsType
.
UInfo
));
bitmap
=
DnsResourceDataNextDomain
.
CreateTypeBitmap
(
new
DnsType
[]
{
0
});
bitmap
=
DnsResourceDataNextDomain
.
CreateTypeBitmap
(
new
DnsType
[]
{
0
});
Assert
.
AreEqual
(
DataSegment
.
Empty
,
bitmap
);
Assert
.
AreEqual
(
DataSegment
.
Empty
,
bitmap
);
...
@@ -279,6 +280,34 @@ namespace PcapDotNet.Packets.Test
...
@@ -279,6 +280,34 @@ namespace PcapDotNet.Packets.Test
Assert
.
Fail
();
Assert
.
Fail
();
}
}
[
TestMethod
]
public
void
DnsResourceDataNextDomainParseWrongLengthTest
()
{
var
resourceData
=
new
DnsResourceDataNextDomain
(
new
DnsDomainName
(
"pcapdot.net"
),
DnsResourceDataNextDomain
.
CreateTypeBitmap
(
new
[]
{
DnsType
.
A
,
DnsType
.
A6
}));
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
NextDomain
,
resourceData
,
1
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
NextDomain
,
resourceData
,
12
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
NextDomain
,
resourceData
,
-
6
);
}
[
TestMethod
]
[
ExpectedException
(
typeof
(
ArgumentNullException
))]
public
void
DnsResourceDataNextDomainConstructorNullTypeBitmapTest
()
{
var
resourceData
=
new
DnsResourceDataNextDomain
(
DnsDomainName
.
Root
,
null
);
Assert
.
IsNull
(
resourceData
);
Assert
.
Fail
();
}
[
TestMethod
]
[
ExpectedException
(
typeof
(
ArgumentNullException
))]
public
void
DnsResourceDataNextDomainCreateTypeBitmapNullInputTest
()
{
var
bitmap
=
DnsResourceDataNextDomain
.
CreateTypeBitmap
(
null
);
Assert
.
IsNull
(
bitmap
);
Assert
.
Fail
();
}
[
TestMethod
]
[
TestMethod
]
public
void
DnsResourceDataNamingAuthorityPointerTest
()
public
void
DnsResourceDataNamingAuthorityPointerTest
()
{
{
...
@@ -637,6 +666,14 @@ namespace PcapDotNet.Packets.Test
...
@@ -637,6 +666,14 @@ namespace PcapDotNet.Packets.Test
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
A6
,
resourceData
,
-
17
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
A6
,
resourceData
,
-
17
);
}
}
[
TestMethod
]
public
void
DnsResourceDataAddressPrefixListParseWrongLengthTest
()
{
var
resourceData
=
new
DnsResourceDataAddressPrefixList
(
new
DnsAddressPrefix
(
AddressFamily
.
IpV4
,
0
,
false
,
new
DataSegment
(
new
byte
[
5
])));
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
Apl
,
resourceData
,
1
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
Apl
,
resourceData
,
-
1
);
}
private
static
void
TestDomainNameCompression
(
int
expectedCompressionBenefit
,
DnsLayer
dnsLayer
)
private
static
void
TestDomainNameCompression
(
int
expectedCompressionBenefit
,
DnsLayer
dnsLayer
)
{
{
dnsLayer
.
DomainNameCompressionMode
=
DnsDomainNameCompressionMode
.
Nothing
;
dnsLayer
.
DomainNameCompressionMode
=
DnsDomainNameCompressionMode
.
Nothing
;
...
...
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