Exemplo n.º 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());
        }
        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_WhenCallingPackMethodShouldThrowExceptionWithEmptyNuGetOutputPath()
        {
            var testNuGetProcess = new TestNuGetProcess();

            var callNuGetPackageCommandLine = new CallNuGetPackageCommandLine { NuGetProcess = testNuGetProcess };

            callNuGetPackageCommandLine.NuGetPackaging(NuGetFile, NuGetSpecFilePath, null, NuGetPackBasePath, NuGetVersion, string.Empty, null);
        }
Exemplo n.º 4
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);
        }