public void CanCallScriptWithoutErrors() { var errorsAndInfos = new ErrorsAndInfos(); Sut.CallCake(ScriptsFolder.FullName + @"\success.cake", errorsAndInfos); Assert.IsFalse(errorsAndInfos.Errors.Any(), errorsAndInfos.ErrorsPlusRelevantInfos()); Assert.IsTrue(errorsAndInfos.Infos.Any(m => m.Contains(@"Task"))); Assert.IsTrue(errorsAndInfos.Infos.Any(m => m.Contains(@"Duration"))); Assert.IsTrue(errorsAndInfos.Infos.Any(m => m.Contains(@"00:00:00"))); }
public bool Build(string solutionFileName, bool debug, string tempFolderName, IErrorsAndInfos errorsAndInfos) { var config = debug ? "Debug" : "Release"; var cakeScript = new List <string> { "Task(\"Build\")", ".Does(() => {", $"MSBuild(@\"{solutionFileName}\", settings ", "=> settings", $".SetConfiguration(\"{config}\")", ".SetVerbosity(Verbosity.Minimal)", ".WithProperty(\"Platform\", \"Any CPU\")", tempFolderName == "" ? "" : $".WithProperty(\"OutDir\", @\"{tempFolderName}\")", ");", "});", "RunTarget(\"Build\");" }; var folder = new Folder(Path.GetTempPath()).SubFolder("AspenlaubTemp").SubFolder(nameof(CakeBuilder)); folder.CreateIfNecessary(); var cakeFileName = folder.FullName + @"\" + "build-" + Guid.NewGuid() + ".cake"; File.WriteAllText(cakeFileName, string.Join("\r\n", cakeScript)); CakeRunner.CallCake(cakeFileName, errorsAndInfos); if (!errorsAndInfos.Errors.Any(e => e.Contains("The file is locked"))) { errorsAndInfos.Infos.Where(e => e.Contains("The file is locked")).ToList().ForEach(e => errorsAndInfos.Errors.Add(e)); } return(!errorsAndInfos.Errors.Any()); }
public void RunBuildCakeScript(string buildCakeName, ITestTargetFolder testTargetFolder, string target, IErrorsAndInfos errorsAndInfos) { var scriptFileFullName = testTargetFolder.FullName() + @"\" + buildCakeName; vCakeRunner.CallCake(scriptFileFullName, target, errorsAndInfos); }