コード例 #1
0
        public void CopyVariablesToEnvironment_MapsApplicationMapToEnvironment()
        {
            _runner = new CommandLineRunner(_log.Object, _config.Object, _fs.Object, _output);
            var map = new ApplicationMap("testApp", "c:\\install\\path");

            _config.Setup(x => x.ApplicationMap).Returns(map);
            var startInfo = new ProcessStartInfo {
                FileName = HookFileName
            };

            _runner.CopyVariablesToEnvironment(startInfo);

            const string prefix             = "Deployd.";
            var          countOfDeploydKeys = startInfo.EnvironmentVariables.Keys.Cast <string>().Count(var => var.StartsWith(prefix));

            Assert.That(startInfo.EnvironmentVariables[prefix + "AppName"], Is.EqualTo(map.AppName));
            Assert.That(startInfo.EnvironmentVariables[prefix + "InstallPath"], Is.EqualTo(map.InstallPath));
            Assert.That(startInfo.EnvironmentVariables[prefix + "Lock"], Is.EqualTo(map.Lock));
            Assert.That(startInfo.EnvironmentVariables[prefix + "Lockfile"], Is.EqualTo(map.Lockfile));
            Assert.That(startInfo.EnvironmentVariables[prefix + "Staging"], Is.EqualTo(map.Staging));
            Assert.That(startInfo.EnvironmentVariables[prefix + "VersionFile"], Is.EqualTo(map.VersionFile));
            Assert.That(countOfDeploydKeys, Is.GreaterThan(0));
        }