public void CanBuildAndBuildWithoutChanges() { this.DuplicateTestDataToTestFolder(@"Integration\MsbuildIntegrationTests\SimpleMsi"); MSBuild msb = new MSBuild(); msb.Properties.Add("WixToolPath", Settings.WixToolsDirectory); msb.Properties.Add("WixTargetsPath", Settings.WixTargetsPath); msb.Properties.Add("WixTasksPath", Settings.WixTasksPath); msb.ProjectFile = "SimpleMsi.wixproj"; var result = msb.Run(); Assert.Contains("Building target \"Compile\" completely.", result.StandardOutput); Assert.Contains("Building target \"Link\" completely.", result.StandardOutput); var context = this.TestContext; var firstPassFiles = Directory.GetFiles(context.TestDirectory, "*", SearchOption.AllDirectories).Select(p => new { Path = p, Hash = this.GetHash(p), Modified = File.GetLastWriteTime(p) }).ToList(); result = msb.Run(); Assert.Contains("Skipping target \"Compile\" because all output files are up-to-date with respect to the input files.", result.StandardOutput); Assert.Contains("Skipping target \"Link\" because all output files are up-to-date with respect to the input files.", result.StandardOutput); var secondPassFiles = Directory.GetFiles(context.TestDirectory, "*", SearchOption.AllDirectories).Select(p => new { Path = p, Hash = this.GetHash(p), Modified = File.GetLastWriteTime(p) }).ToList(); foreach (var st in secondPassFiles) { var m = firstPassFiles.Where(f => f.Path == st.Path).SingleOrDefault(); Assert.NotNull(m); Assert.Equal(m.Hash, st.Hash); } this.Complete(); }
public void CanBuildAndClean() { this.DuplicateTestDataToTestFolder(@"Integration\MsbuildIntegrationTests\SimpleMsi"); var context = this.TestContext; string binPath = Path.Combine(context.TestDirectory, "bin\\"); string objPath = Path.Combine(context.TestDirectory, "obj\\"); // Build MSBuild msb = new MSBuild(); msb.Properties.Add("WixToolPath", Settings.WixToolsDirectory); msb.Properties.Add("WixTargetsPath", Settings.WixTargetsPath); msb.Properties.Add("WixTasksPath", Settings.WixTasksPath); msb.ProjectFile = "SimpleMsi.wixproj"; var result = msb.Run(); Assert.Contains("Building target \"Compile\" completely.", result.StandardOutput); Assert.Contains("Building target \"Link\" completely.", result.StandardOutput); var built = Directory.GetFiles(binPath, "*", SearchOption.AllDirectories); var intermediate = Directory.GetFiles(objPath, "*", SearchOption.AllDirectories); Assert.NotEmpty(built); // Clean msb.Targets.Add("Clean"); result = msb.Run(); var cleanBin = Directory.GetFiles(binPath, "*", SearchOption.AllDirectories); var cleanObj = Directory.GetFiles(objPath, "*", SearchOption.AllDirectories); Assert.Empty(cleanBin); Assert.Empty(cleanObj); this.Complete(); }
public void CanBuildAndClean() { this.Initialize(@"TestData\SimpleMsi\"); this.DuplicateTestDataToTestFolder(); string binPath = Path.Combine(this.TestFolder, "bin\\"); string objPath = Path.Combine(this.TestFolder, "obj\\"); // Build MSBuild msb = new MSBuild(); msb.Properties.Add("WixTargetsPath", Settings.WixTargetsPath); msb.ProjectFile = "SimpleMsi.wixproj"; var result = msb.Run(); Assert.Contains("Building target \"Compile\" completely.", result.StandardOutput); Assert.Contains("Building target \"Link\" completely.", result.StandardOutput); var built = Directory.GetFiles(binPath, "*", SearchOption.AllDirectories); var intermediate = Directory.GetFiles(objPath, "*", SearchOption.AllDirectories); Assert.NotEmpty(built); // Clean msb.Targets.Add("Clean"); result = msb.Run(); var cleanBin = Directory.GetFiles(binPath, "*", SearchOption.AllDirectories); var cleanObj = Directory.GetFiles(objPath, "*", SearchOption.AllDirectories); Assert.Empty(cleanBin); Assert.Empty(cleanObj); this.Completed(); }