Commit 136b512d authored by Brickner_cp's avatar Brickner_cp

Fix Wireshark tests to work in other locales.

parent a1d11f17
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using PcapDotNet.Base; using PcapDotNet.Base;
...@@ -60,9 +61,9 @@ namespace PcapDotNet.Core.Test ...@@ -60,9 +61,9 @@ namespace PcapDotNet.Core.Test
else if (quickStart.RateKbps < 1024) else if (quickStart.RateKbps < 1024)
quickStartWireshark.Append(quickStart.RateKbps + " kbit/s"); quickStartWireshark.Append(quickStart.RateKbps + " kbit/s");
else if (quickStart.RateKbps < 1024 * 1024) else if (quickStart.RateKbps < 1024 * 1024)
quickStartWireshark.Append(((double)quickStart.RateKbps / 1000) + " Mbit/s"); quickStartWireshark.Append(((double)quickStart.RateKbps / 1000).ToString(CultureInfo.InvariantCulture) + " Mbit/s");
else else
quickStartWireshark.Append(((double)quickStart.RateKbps / 1000000) + " Gbit/s"); quickStartWireshark.Append(((double)quickStart.RateKbps / 1000000).ToString(CultureInfo.InvariantCulture) + " Gbit/s");
if (quickStart.Function == IpV4OptionQuickStartFunction.RateRequest) if (quickStart.Function == IpV4OptionQuickStartFunction.RateRequest)
quickStartWireshark.Append(", QS TTL " + quickStart.Ttl); quickStartWireshark.Append(", QS TTL " + quickStart.Ttl);
......
...@@ -438,7 +438,7 @@ namespace PcapDotNet.Core.Test ...@@ -438,7 +438,7 @@ namespace PcapDotNet.Core.Test
try try
{ {
Compare(XDocument.Load(fixedDocumentFilename), packets); Compare(XDocument.Load(fixedDocumentFilename,LoadOptions.None), packets);
} }
catch (AssertFailedException exception) catch (AssertFailedException exception)
{ {
...@@ -529,7 +529,7 @@ namespace PcapDotNet.Core.Test ...@@ -529,7 +529,7 @@ namespace PcapDotNet.Core.Test
// break; // break;
case "frame.time_epoch": case "frame.time_epoch":
double timeEpoch = double.Parse(field.Show()); double timeEpoch = double.Parse(field.Show(), CultureInfo.InvariantCulture);
DateTime fieldTimestamp = new DateTime(1970, 1, 1).AddSeconds(timeEpoch); DateTime fieldTimestamp = new DateTime(1970, 1, 1).AddSeconds(timeEpoch);
MoreAssert.IsInRange(fieldTimestamp.AddMilliseconds(-1), fieldTimestamp.AddMilliseconds(1), packet.Timestamp.ToUniversalTime(), "Timestamp"); MoreAssert.IsInRange(fieldTimestamp.AddMilliseconds(-1), fieldTimestamp.AddMilliseconds(1), packet.Timestamp.ToUniversalTime(), "Timestamp");
break; break;
......
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