Skip to content

Commit

Permalink
Validate hash on windows only
Browse files Browse the repository at this point in the history
  • Loading branch information
haga-rak committed Jan 21, 2024
1 parent a469f89 commit 8150817
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
9 changes: 7 additions & 2 deletions test/Fluxzy.Tests/Cli/Pack/DissectPcapTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2021 - Haga Rakotoharivelo - https://github.com/haga-rak

using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Fluxzy.Tests._Fixtures;
using Fluxzy.Tests.Cli.Scaffolding;
Expand All @@ -25,7 +26,9 @@ public async Task Export_From_Directory()

Assert.Equal(0, runResult.ExitCode);
Assert.True(File.Exists(fileName));
Assert.Equal(Startup.DefaultMergeArchivePcapHash, HashHelper.MakeWinGetHash(fileName));

if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Assert.Equal(Startup.DefaultMergeArchivePcapHash, HashHelper.MakeWinGetHash(fileName));
}

[Fact]
Expand All @@ -37,7 +40,9 @@ public async Task Export_From_Archive()

Assert.Equal(0, runResult.ExitCode);
Assert.True(File.Exists(fileName));
Assert.Equal(Startup.DefaultMergeArchivePcapHash, HashHelper.MakeWinGetHash(fileName));

if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Assert.Equal(Startup.DefaultMergeArchivePcapHash, HashHelper.MakeWinGetHash(fileName));
}

[Fact]
Expand Down
16 changes: 12 additions & 4 deletions test/Fluxzy.Tests/UnitTests/Pcap/Merge/PcapMergeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using Fluxzy.Core.Pcap.Pcapng.Merge;
using Fluxzy.Tests._Fixtures;
using Xunit;
Expand Down Expand Up @@ -58,7 +59,9 @@ public void Validate_With_Fix_Hash(int concurrentFileOpen)
}

Assert.True(File.Exists(outFile));
Assert.Equal(Startup.DefaultMergeArchivePcapHash, HashHelper.MakeWinGetHash(outFile));

if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Assert.Equal(Startup.DefaultMergeArchivePcapHash, HashHelper.MakeWinGetHash(outFile));
}

[Fact]
Expand All @@ -72,7 +75,9 @@ public void Validate_With_Dump_Directory()
}

Assert.True(File.Exists(outFile));
Assert.Equal(Startup.DefaultMergeArchivePcapHash, HashHelper.MakeWinGetHash(outFile));

if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Assert.Equal(Startup.DefaultMergeArchivePcapHash, HashHelper.MakeWinGetHash(outFile));
}

[Fact]
Expand All @@ -86,7 +91,9 @@ public void Validate_With_Archive()
}

Assert.True(File.Exists(outFile));
Assert.Equal(Startup.DefaultMergeArchivePcapHash, HashHelper.MakeWinGetHash(outFile));

if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Assert.Equal(Startup.DefaultMergeArchivePcapHash, HashHelper.MakeWinGetHash(outFile));
}

[Fact]
Expand Down Expand Up @@ -116,7 +123,8 @@ public void Validate_With_Dump_Directory_Filtered_Connection()
}

Assert.True(File.Exists(outFile));
Assert.Equal(Startup.DefaultMergeArchivePcapHash, HashHelper.MakeWinGetHash(outFile));
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Assert.Equal(Startup.DefaultMergeArchivePcapHash, HashHelper.MakeWinGetHash(outFile));
}

[Theory]
Expand Down

0 comments on commit 8150817

Please sign in to comment.