Example #1
0
        public void CallNuGetPackageCommandLineTests_WhenCallingPackagingMethodShouldFormatPackParametersCorrectly()
        {
            var nuGetFilePath = string.Empty;

            if (!string.IsNullOrWhiteSpace(TestContext.DataRow["NuGetFilePath"].ToString()))
            {
                nuGetFilePath = GetNugetFilePath(TestContext.DeploymentDirectory);
            }

            var nuGetPackBasePath = TestContext.DataRow["NuGetPackBasePath"].ToString();
            var nuGetSpecFilePath = TestContext.DataRow["NuGetSpecFilePath"].ToString();
            var nuGetOutputPath   = TestContext.DataRow["NuGetOutputPath"].ToString();
            var nuGetVersion      = TestContext.DataRow["NuGetVersion"].ToString();

            var testNuGetProcess = new TestNuGetProcess();

            var callNuGetPackageCommandLine = new CallNuGetPackageCommandLine {
                NuGetProcess = testNuGetProcess
            };

            callNuGetPackageCommandLine.NuGetPackaging(nuGetFilePath, nuGetSpecFilePath, nuGetOutputPath, nuGetPackBasePath, nuGetVersion, string.Empty, null);

            const string expectedResult = "pack \"C:\\BuildFolder\\myproject.nuspec\" -OutputDirectory \"C:\\BuildFolder\\NuGetPackage\" -BasePath \"C:\\BuildFolder\\PackFolder\" -version 1.2.3.4";

            //Assert.AreEqual(NuGetFilePath, testNuGetProcess.NuGetFilePath);
            Assert.AreEqual(expectedResult, testNuGetProcess.Arguments.Trim());
        }
Example #2
0
        public void CallNuGetPackageCommandLineTests_WhenCallingPushMethodShouldFormatPushParametersCorrectly()
        {
            var nuGetFilePath = string.Empty;

            if (!string.IsNullOrWhiteSpace(TestContext.DataRow["NuGetFilePath"].ToString()))
            {
                nuGetFilePath = GetNugetFilePath(TestContext.DeploymentDirectory);
            }

            var nuGetPushDestination = TestContext.DataRow["NuGetPushDestination"].ToString();
            var nuGetPackageLocation = TestContext.DataRow["NuGetOutputPath"].ToString();
            var apiKey = TestContext.DataRow["ApiKey"].ToString();

            var testNuGetProcess = new TestNuGetProcess();

            var pushWithNuGet = new PushWithNuGet {
                NuGetProcess = testNuGetProcess
            };

            if (string.IsNullOrWhiteSpace(nuGetFilePath))
            {
                nuGetFilePath = "nuget.exe";
            }

            pushWithNuGet.NuGetPublishing(nuGetFilePath, nuGetPackageLocation, nuGetPushDestination, apiKey, null);

            string expectedResult = string.Format("push \"{0}\" {1} -s \"{2}\"",
                                                  nuGetPackageLocation, apiKey, nuGetPushDestination);

            //Assert.AreEqual(nuGetFilePath, testNuGetProcess.NuGetFilePath);
            Assert.AreEqual(expectedResult, testNuGetProcess.Arguments);
        }
        public void CallNuGetPackageCommandLineTests_WhenCallingPackagingMethodShouldFormatPackParametersCorrectly()
        {
            var nuGetFilePath = string.Empty;

            if (!string.IsNullOrWhiteSpace(TestContext.DataRow["NuGetFilePath"].ToString()))
            {
                nuGetFilePath = GetNugetFilePath(TestContext.DeploymentDirectory);
            }

            var nuGetPackBasePath = TestContext.DataRow["NuGetPackBasePath"].ToString();
            var nuGetSpecFilePath = TestContext.DataRow["NuGetSpecFilePath"].ToString();
            var nuGetOutputPath = TestContext.DataRow["NuGetOutputPath"].ToString();
            var nuGetVersion = TestContext.DataRow["NuGetVersion"].ToString();

            var testNuGetProcess = new TestNuGetProcess();

            var callNuGetPackageCommandLine = new CallNuGetPackageCommandLine { NuGetProcess = testNuGetProcess };

            callNuGetPackageCommandLine.NuGetPackaging(nuGetFilePath, nuGetSpecFilePath, nuGetOutputPath, nuGetPackBasePath, nuGetVersion, string.Empty, null);

            const string expectedResult = "pack \"C:\\BuildFolder\\myproject.nuspec\" -OutputDirectory \"C:\\BuildFolder\\NuGetPackage\" -BasePath \"C:\\BuildFolder\\PackFolder\" -version 1.2.3.4";

            //Assert.AreEqual(NuGetFilePath, testNuGetProcess.NuGetFilePath);
            Assert.AreEqual(expectedResult, testNuGetProcess.Arguments.Trim());
        }
        public void CallNuGetPackageCommandLineTests_WhenCallingPackMethodShouldThrowExceptionWithEmptyNuGetPackageLocation()
        {
            var testNuGetProcess = new TestNuGetProcess();

            var pushWithNuGet = new PushWithNuGet { NuGetProcess = testNuGetProcess };

            pushWithNuGet.NuGetPublishing(NuGetFile, null, NuGetPushDestination, ApiKey, null);
        }
        public void CallNuGetPackageCommandLineTests_WhenCallingPackMethodShouldThrowExceptionWithEmptyNuGetOutputPath()
        {
            var testNuGetProcess = new TestNuGetProcess();

            var callNuGetPackageCommandLine = new CallNuGetPackageCommandLine { NuGetProcess = testNuGetProcess };

            callNuGetPackageCommandLine.NuGetPackaging(NuGetFile, NuGetSpecFilePath, null, NuGetPackBasePath, NuGetVersion, string.Empty, null);
        }
Example #6
0
        public void CallNuGetPackageCommandLineTests_WhenCallingPackMethodShouldThrowExceptionWithEmptyNuSpecFilePath()
        {
            var testNuGetProcess = new TestNuGetProcess();

            var callNuGetPackageCommandLine = new CallNuGetPackageCommandLine {
                NuGetProcess = testNuGetProcess
            };

            callNuGetPackageCommandLine.NuGetPackaging(NuGetFile, null, NuGetOutputPath, NuGetPackBasePath, NuGetVersion, string.Empty, null);
        }
Example #7
0
        public void CallNuGetPackageCommandLineTests_WhenCallingPackMethodShouldThrowExceptionWithEmptyNuGetPackageLocation()
        {
            var testNuGetProcess = new TestNuGetProcess();

            var pushWithNuGet = new PushWithNuGet {
                NuGetProcess = testNuGetProcess
            };

            pushWithNuGet.NuGetPublishing(NuGetFile, null, NuGetPushDestination, ApiKey, null);
        }
Example #8
0
        public void CallNuGetPackageCommandLineTests_WhenCallingPackMethodWithGoodUrlShouldPushWithoutApiKey()
        {
            var testNuGetProcess = new TestNuGetProcess();

            var pushWithNuGet = new PushWithNuGet()
            {
                NuGetProcess = testNuGetProcess
            };

            var result = pushWithNuGet.NuGetPublishing(NuGetFile, NuGetPackageLocation, "https://nuget.org/", "", null);
        }
        public void CallNuGetPackageCommandLineTests_WhenCallingPushMethodShouldFormatPushParametersCorrectly()
        {
            var nuGetFilePath = string.Empty;

            if (!string.IsNullOrWhiteSpace(TestContext.DataRow["NuGetFilePath"].ToString()))
            {
                nuGetFilePath = GetNugetFilePath(TestContext.DeploymentDirectory);
            }

            var nuGetPushDestination = TestContext.DataRow["NuGetPushDestination"].ToString();
            var nuGetPackageLocation = TestContext.DataRow["NuGetOutputPath"].ToString();
            var apiKey = TestContext.DataRow["ApiKey"].ToString();

            var testNuGetProcess = new TestNuGetProcess();

            var pushWithNuGet = new PushWithNuGet {NuGetProcess = testNuGetProcess};

            if (string.IsNullOrWhiteSpace(nuGetFilePath))
            {
                nuGetFilePath = "nuget.exe";
            }

            pushWithNuGet.NuGetPublishing(nuGetFilePath, nuGetPackageLocation, nuGetPushDestination, apiKey, null);

            string expectedResult = string.Format("push \"{0}\" {1} -s \"{2}\"",
                nuGetPackageLocation, apiKey, nuGetPushDestination);

            //Assert.AreEqual(nuGetFilePath, testNuGetProcess.NuGetFilePath);
            Assert.AreEqual(expectedResult, testNuGetProcess.Arguments);
        }
        public void CallNuGetPackageCommandLineTests_WhenCallingPackMethodWithGoodUrlShouldPushWithoutApiKey()
        {
            var testNuGetProcess = new TestNuGetProcess();

            var pushWithNuGet = new PushWithNuGet() { NuGetProcess = testNuGetProcess };

            var result = pushWithNuGet.NuGetPublishing(NuGetFile, NuGetPackageLocation, "https://nuget.org/", "", null);
        }