コード例 #1
0
        public void FullBuildCompletes()
        {
            var app = _fixture.CreateTestApp("SimpleRepo");

            var build = app.ExecuteBuild(_output, "/p:BuildNumber=0001");

            Assert.Equal(0, build);

            // bootstrapper
            Assert.True(File.Exists(Path.Combine(app.WorkingDirectory, "korebuild-lock.txt")), "Should have created the korebuild lock file");

            // /t:Package
            var libPackage        = Path.Combine(app.WorkingDirectory, "artifacts", "build", "Simple.Lib.1.0.0-beta-0001.nupkg");
            var libSymbolsPackage = Path.Combine(app.WorkingDirectory, "artifacts", "build", "Simple.Lib.1.0.0-beta-0001.symbols.nupkg");

            Assert.True(File.Exists(Path.Combine(app.WorkingDirectory, "artifacts", "build", "Simple.CliTool.1.0.0-beta-0001.nupkg")), "Build should have produced a lib nupkg");
            Assert.True(File.Exists(libPackage), "Build should have produced a lib nupkg");
            Assert.True(File.Exists(libSymbolsPackage), "Build should have produced a symbols lib nupkg");
            Assert.True(File.Exists(Path.Combine(app.WorkingDirectory, "artifacts", "build", "Simple.Sources.1.0.0-beta-0001.nupkg")), "Build should have produced a sources nupkg");

            using (var reader = new PackageArchiveReader(libPackage))
            {
                Assert.Empty(reader.GetFiles().Where(p => Path.GetExtension(p).Equals(".pdb", StringComparison.OrdinalIgnoreCase)));
            }

            // /t:TestNuGetPush
            Assert.True(File.Exists(Path.Combine(app.WorkingDirectory, "obj", "tmp-nuget", "Simple.CliTool.1.0.0-beta-0001.nupkg")), "Build done a test push of all the packages");
            Assert.True(File.Exists(Path.Combine(app.WorkingDirectory, "obj", "tmp-nuget", "Simple.Lib.1.0.0-beta-0001.nupkg")), "Build done a test push of all the packages");
            Assert.True(File.Exists(Path.Combine(app.WorkingDirectory, "obj", "tmp-nuget", "Simple.Sources.1.0.0-beta-0001.nupkg")), "Build done a test push of all the packages");
        }
コード例 #2
0
        public void FullBuildCompletes()
        {
            var app = _fixture.CreateTestApp("SimpleRepo");

            var build = app.ExecuteBuild(_output, "/p:BuildNumber=0001");

            Assert.Equal(0, build);

            // bootstrapper
            Assert.True(File.Exists(Path.Combine(app.WorkingDirectory, "korebuild-lock.txt")), "Should have created the korebuild lock file");

            // /t:Package
            var libPackage        = Path.Combine(app.WorkingDirectory, "artifacts", "build", "Simple.Lib.1.0.0-beta-0001.nupkg");
            var libSymbolsPackage = Path.Combine(app.WorkingDirectory, "artifacts", "build", "Simple.Lib.1.0.0-beta-0001.symbols.nupkg");

            Assert.True(File.Exists(Path.Combine(app.WorkingDirectory, "artifacts", "build", "Simple.CliTool.1.0.0-beta-0001.nupkg")), "Build should have produced a lib nupkg");
            Assert.True(File.Exists(libPackage), "Build should have produced a lib nupkg");
            Assert.True(File.Exists(libSymbolsPackage), "Build should have produced a symbols lib nupkg");
            Assert.True(File.Exists(Path.Combine(app.WorkingDirectory, "artifacts", "build", "Simple.Sources.1.0.0-beta-0001.nupkg")), "Build should have produced a sources nupkg");

            using (var reader = new PackageArchiveReader(libPackage))
            {
                Assert.Empty(reader.GetFiles().Where(p => Path.GetExtension(p).Equals(".pdb", StringComparison.OrdinalIgnoreCase)));
            }

            // /t:TestNuGetPush
            Assert.True(File.Exists(Path.Combine(app.WorkingDirectory, "obj", "tmp-nuget", "Simple.CliTool.1.0.0-beta-0001.nupkg")), "Build done a test push of all the packages");
            Assert.True(File.Exists(Path.Combine(app.WorkingDirectory, "obj", "tmp-nuget", "Simple.Lib.1.0.0-beta-0001.nupkg")), "Build done a test push of all the packages");
            Assert.True(File.Exists(Path.Combine(app.WorkingDirectory, "obj", "tmp-nuget", "Simple.Sources.1.0.0-beta-0001.nupkg")), "Build done a test push of all the packages");

            // /t:GenerateSigningRequest
            var signRequest = Path.Combine(app.WorkingDirectory, "artifacts", "signrequest.xml");

            Assert.True(File.Exists(signRequest), "Sign requests should have been generated");

            var sign     = XDocument.Load(signRequest);
            var excluded = Assert.Single(sign.Descendants("ExcludedFile"));

            Assert.Equal("build/Simple.Sources.1.0.0-beta-0001.nupkg", excluded.Attribute("Path")?.Value);
            Assert.Collection(sign.Descendants("Nupkg"),
                              pkg =>
            {
                Assert.Equal("build/Simple.CliTool.1.0.0-beta-0001.nupkg", pkg.Attribute("Path")?.Value);
                Assert.Equal("MyPackageSigningCert", pkg.Attribute("Certificate")?.Value);
                Assert.Collection(pkg.Descendants("File"),
                                  a =>
                {
                    Assert.Equal("tools/netcoreapp2.1/any/Newtonsoft.Json.dll", a.Attribute("Path")?.Value);
                    Assert.Equal("Test3rdPartyCert", a.Attribute("Certificate")?.Value);
                },
                                  a =>
                {
                    Assert.Equal("tools/netcoreapp2.1/any/cowsay.dll", a.Attribute("Path")?.Value);
                    Assert.Equal("TestCert", a.Attribute("Certificate")?.Value);
                },
                                  a =>
                {
                    Assert.Equal("tools/netcoreapp2.1/any/shims/win-x64/cowsay.exe", a.Attribute("Path")?.Value);
                    Assert.Equal("TestCert", a.Attribute("Certificate")?.Value);
                },
                                  a =>
                {
                    Assert.Equal("tools/netcoreapp2.1/any/shims/win-x86/cowsay.exe", a.Attribute("Path")?.Value);
                    Assert.Equal("TestCert", a.Attribute("Certificate")?.Value);
                });
            },
                              pkg =>
            {
                Assert.Equal("build/Simple.CliTool.1.0.0-beta-0001.symbols.nupkg", pkg.Attribute("Path")?.Value);
            },
                              pkg =>
            {
                Assert.Equal("build/Simple.Lib.1.0.0-beta-0001.nupkg", pkg.Attribute("Path")?.Value);
                Assert.Null(pkg.Attribute("Certificate"));
                Assert.Collection(pkg.Descendants("File"),
                                  a =>
                {
                    Assert.Equal("lib/net461/Simple.Lib.dll", a.Attribute("Path")?.Value);
                    Assert.Equal("TestCert", a.Attribute("Certificate")?.Value);
                },
                                  a =>
                {
                    Assert.Equal("lib/netstandard2.0/Simple.Lib.dll", a.Attribute("Path")?.Value);
                    Assert.Equal("TestCert", a.Attribute("Certificate")?.Value);
                });
            },
                              pkg =>
            {
                Assert.Equal("build/Simple.Lib.1.0.0-beta-0001.symbols.nupkg", pkg.Attribute("Path")?.Value);
                Assert.Null(pkg.Attribute("Certificate"));
                Assert.Collection(pkg.Descendants("File"),
                                  a =>
                {
                    Assert.Equal("lib/net461/Simple.Lib.dll", a.Attribute("Path")?.Value);
                    Assert.Equal("TestCert", a.Attribute("Certificate")?.Value);
                },
                                  a =>
                {
                    Assert.Equal("lib/netstandard2.0/Simple.Lib.dll", a.Attribute("Path")?.Value);
                    Assert.Equal("TestCert", a.Attribute("Certificate")?.Value);
                });
            });
        }