public void StandardExecutionMode_CanDetermineTheVersionFromALocalFeature() { var repoPath = CheckoutLocal(ASBMTestRepoWorkingDirPath, "refs/heads/feature/one"); var task = new UpdateAssemblyInfo { BuildEngine = new MockBuildEngine(), SolutionDirectory = repoPath, }; task.InnerExecute(); }
public void StandardExecutionMode_CanAcceptAssemblyVersioningSchemes(string assemblyVersioningScheme) { var repoPath = CheckoutLocal(ASBMTestRepoWorkingDirPath, "refs/heads/master"); var task = new UpdateAssemblyInfo { BuildEngine = new MockBuildEngine(), SolutionDirectory = repoPath, AssemblyVersioningScheme = assemblyVersioningScheme }; task.InnerExecute(); }
public static bool UpdateAssemblyInfo(UpdateAssemblyInfo task) { return(ExecuteGitVersionTask(task, t => { FileHelper.DeleteTempFiles(); FileHelper.CheckForInvalidFiles(t.CompileFiles, t.ProjectFile); if (!GetVersionVariables(t, out var versionVariables)) { return; } var fileWriteInfo = t.IntermediateOutputPath.GetFileWriteInfo(t.Language, t.ProjectFile, "AssemblyInfo"); t.AssemblyInfoTempFilePath = Path.Combine(fileWriteInfo.WorkingDirectory, fileWriteInfo.FileName); using (var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(fileWriteInfo.FileName, fileWriteInfo.WorkingDirectory, versionVariables, new FileSystem(), true)) { assemblyInfoFileUpdater.Update(); assemblyInfoFileUpdater.CommitChanges(); } })); }
public void StandardExecutionMode_DoesNotRequireARemoteToOperate() { using (var repo = new Repository(ASBMTestRepoWorkingDirPath)) { Assert.AreEqual(0, repo.Network.Remotes.Count()); } var task = new UpdateAssemblyInfo { BuildEngine = new MockBuildEngine(), SolutionDirectory = ASBMTestRepoWorkingDirPath, }; task.InnerExecute(); }
public void StandardExecutionMode_ThrowsUponUnexpectedAssemblyVersioningSchemes() { var repoPath = CheckoutLocal(ASBMTestRepoWorkingDirPath, "refs/heads/master"); var task = new UpdateAssemblyInfo { BuildEngine = new MockBuildEngine(), SolutionDirectory = repoPath, AssemblyVersioningScheme = "Boom" }; var exception = Assert.Throws<WarningException>(task.InnerExecute); Assert.AreEqual("Unexpected assembly versioning scheme 'Boom'.", exception.Message); }
public void StandardExecutionMode_LackOfAValidGitDirectoryDoesNotPreventExecution() { var task = new UpdateAssemblyInfo { BuildEngine = new MockBuildEngine(), SolutionDirectory = Path.GetTempPath(), }; task.InnerExecute(); }
public void StandardExecutionMode_CannotDetermineTheVersionFromADetachedHead() { var repoPath = Clone(ASBMTestRepoWorkingDirPath); using (var repo = new Repository(repoPath)) { repo.Checkout("469f851"); Assert.IsTrue(repo.Info.IsHeadDetached); } var task = new UpdateAssemblyInfo { BuildEngine = new MockBuildEngine(), SolutionDirectory = repoPath, }; var exception = Assert.Throws<ErrorException>(task.InnerExecute); Assert.AreEqual("It looks like the branch being examined is a detached Head pointing to commit '469f851'. Without a proper branch name GitVersion cannot determine the build version.", exception.Message); }