Ejemplo n.º 1
0
        public void Publish_WithLinkerAndCompression_IsIncremental()
        {
            // Arrange
            var testAppName  = "BlazorHosted";
            var testInstance = CreateAspNetSdkTestAsset(testAppName);

            var publishCommand = new PublishCommand(Log, Path.Combine(testInstance.TestRoot, "blazorhosted"));

            publishCommand.Execute().Should().Pass();

            var buildOutputDirectory = publishCommand.GetOutputDirectory(DefaultTfm);

            // Act
            var compressedFilesFolder = Path.Combine(testInstance.TestRoot, "blazorwasm", "obj", "Debug", DefaultTfm, "compress");
            var thumbPrint            = FileThumbPrint.CreateFolderThumbprint(testInstance, compressedFilesFolder);

            // Assert
            for (var i = 0; i < 3; i++)
            {
                var buildCommand = new BuildCommand(testInstance, "blazorhosted");
                buildCommand.Execute().Should().Pass();

                var newThumbPrint = FileThumbPrint.CreateFolderThumbprint(testInstance, compressedFilesFolder);
                Assert.Equal(thumbPrint.Count, newThumbPrint.Count);
                for (var j = 0; j < thumbPrint.Count; j++)
                {
                    Assert.Equal(thumbPrint[j], newThumbPrint[j]);
                }
            }
        }
        public void Build_GzipCompression_IsIncremental()
        {
            // Arrange
            var testAsset        = "BlazorWasmWithLibrary";
            var projectDirectory = CreateAspNetSdkTestAsset(testAsset);

            var build = new BuildCommand(projectDirectory, "blazorwasm");

            build.Execute()
            .Should()
            .Pass();

            var gzipCompressionDirectory = Path.Combine(projectDirectory.TestRoot, "blazorwasm", "obj", "Debug", DefaultTfm, "build-gz");

            new DirectoryInfo(gzipCompressionDirectory).Should().Exist();

            // Act
            var thumbPrint = FileThumbPrint.CreateFolderThumbprint(projectDirectory, gzipCompressionDirectory);

            // Assert
            for (var i = 0; i < 3; i++)
            {
                build = new BuildCommand(projectDirectory, "blazorwasm");
                build.Execute()
                .Should()
                .Pass();

                var newThumbPrint = FileThumbPrint.CreateFolderThumbprint(projectDirectory, gzipCompressionDirectory);
                Assert.Equal(thumbPrint.Count, newThumbPrint.Count);
                for (var j = 0; j < thumbPrint.Count; j++)
                {
                    thumbPrint[j].Equals(newThumbPrint[j]).Should().BeTrue();
                }
            }
        }
Ejemplo n.º 3
0
        public void Build_IsIncremental()
        {
            // Arrange
            var testAsset        = "BlazorWasmWithLibrary";
            var projectDirectory = CreateAspNetSdkTestAsset(testAsset);

            var build = new BuildCommand(projectDirectory, "blazorwasm");

            build.Execute()
            .Should()
            .Pass();

            var buildOutputDirectory = build.GetOutputDirectory(DefaultTfm).ToString();

            // Act
            var thumbPrint = FileThumbPrint.CreateFolderThumbprint(projectDirectory, buildOutputDirectory);

            // Assert
            for (var i = 0; i < 3; i++)
            {
                build = new BuildCommand(projectDirectory, "blazorwasm");
                build.Execute().Should().Pass();

                var newThumbPrint = FileThumbPrint.CreateFolderThumbprint(projectDirectory, buildOutputDirectory);
                newThumbPrint.Count.Should().Be(thumbPrint.Count);
                for (var j = 0; j < thumbPrint.Count; j++)
                {
                    thumbPrint[j].Equals(newThumbPrint[j]).Should().BeTrue();
                }
            }
        }
Ejemplo n.º 4
0
        public void Publish_WithoutLinkerAndCompression_IsIncremental()
        {
            // Arrange
            var testAppName  = "BlazorHosted";
            var testInstance = _testAssetsManager.CopyTestAsset(testAppName)
                               .WithSource();

            var publishCommand = new PublishCommand(Log, Path.Combine(testInstance.TestRoot, "blazorhosted"));

            publishCommand.Execute("/p:BlazorWebAssemblyEnableLinking=false")
            .Should().Pass();

            var buildOutputDirectory = publishCommand.GetOutputDirectory("net5.0");

            // Act
            var compressedFilesFolder = Path.Combine(testInstance.TestRoot, "blazorwasm", "obj", "Debug", "net5.0", "compress");
            var thumbPrint            = FileThumbPrint.CreateFolderThumbprint(testInstance, compressedFilesFolder);

            // Assert
            for (var i = 0; i < 3; i++)
            {
                var buildCommand = new BuildCommand(testInstance, "blazorhosted");
                buildCommand.Execute("/p:BlazorWebAssemblyEnableLinking=false").Should().Pass();

                var newThumbPrint = FileThumbPrint.CreateFolderThumbprint(testInstance, compressedFilesFolder);
                Assert.Equal(thumbPrint.Count, newThumbPrint.Count);
                for (var j = 0; j < thumbPrint.Count; j++)
                {
                    Assert.Equal(thumbPrint[j], newThumbPrint[j]);
                }
            }
        }