Example #1
0
        public void Deserialize_XCopy_Package_Descriptor_Test()
        {
            System.Environment.CurrentDirectory = "samples".MapVcsRoot();

            MsBuild("PowerDeploy.Sample.XCopy\\PowerDeploy.Sample.XCopy.csproj /t:clean,build /p:RunOctoPack=true /p:OctoPackPackageVersion=1.3.3.7 /p:Configuration=Release /v:m");

            var environmentMock = new Mock<IEnvironmentProvider>();
            environmentMock.Setup(prov => prov.GetEnvironment(It.IsAny<string>())).Returns(GetUnitEnvironment);

            var outputPath = FileSystem.CreateTempWorkingDir();

            var target = new PackageManager(environmentMock.Object);
            target.ConfigurePackageByEnvironment(@"PowerDeploy.Sample.XCopy\obj\octopacked\PowerDeploy.Sample.XCopy.1.3.3.7.nupkg", "Unit", outputPath);

            var nupkg = new ZipPackage(Path.Combine(outputPath, "PowerDeploy.Sample.XCopy_v1.3.3.7_UNIT.nupkg"));
            var options = nupkg.GetPackageOptions<XCopyOptions>();

            Assert.AreEqual("xcopy", nupkg.PeekPackageType());
            Assert.AreEqual(@"c:\temp", options.Destination);
            Assert.AreEqual("UNIT", options.Environment);
        }