From 65389c46c5c6d32c11016a3d670fb554e33c4b20 Mon Sep 17 00:00:00 2001 From: Swaroop Sridhar Date: Fri, 17 Apr 2020 18:40:55 -0700 Subject: [PATCH] Single-File Bundler: Add a FileSize test Add a bundler consistency tests that verifies that the size of each embedded file (recorded in the bundle manifest) matches its original size of the file on disk. --- .../BundlerConsistencyTests.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/installer/test/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.Bundle.Tests/BundlerConsistencyTests.cs b/src/installer/test/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.Bundle.Tests/BundlerConsistencyTests.cs index 2e0bda9e45ed32..00f3b1cc843c26 100644 --- a/src/installer/test/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.Bundle.Tests/BundlerConsistencyTests.cs +++ b/src/installer/test/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.Bundle.Tests/BundlerConsistencyTests.cs @@ -143,6 +143,17 @@ public void TestBundlingNativeBinaries(BundleOptions options) bundler.BundleManifest.Contains($"{coreclr}").Should().Be(options.HasFlag(BundleOptions.BundleNativeBinaries)); } + [Fact] + public void TestFileSizes() + { + var fixture = sharedTestState.TestFixture.Copy(); + var bundler = BundleHelper.Bundle(fixture); + var publishPath = BundleHelper.GetPublishPath(fixture); + + bundler.BundleManifest.Files.ForEach(file => + Assert.True(file.Size == new FileInfo(Path.Combine(publishPath, file.RelativePath)).Length)); + } + [Fact] public void TestAssemblyAlignment() {