コード例 #1
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);
        }
コード例 #2
0
        public void CallNuGetPackageCommandLineTests_WhenCallingPackMethodShouldThrowExceptionWithEmptyNuGetPackageLocation()
        {
            var testNuGetProcess = new TestNuGetProcess();

            var pushWithNuGet = new PushWithNuGet { NuGetProcess = testNuGetProcess };

            pushWithNuGet.NuGetPublishing(NuGetFile, null, NuGetPushDestination, ApiKey, null);
        }
コード例 #3
0
        public void CallNuGetPackageCommandLineTests_WhenCallingPackMethodShouldThrowExceptionWithEmptyNuGetPackageLocation()
        {
            var testNuGetProcess = new TestNuGetProcess();

            var pushWithNuGet = new PushWithNuGet {
                NuGetProcess = testNuGetProcess
            };

            pushWithNuGet.NuGetPublishing(NuGetFile, null, NuGetPushDestination, ApiKey, null);
        }
コード例 #4
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);
        }
コード例 #5
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);
        }
コード例 #6
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);
        }