public void GetProjectReferencePaths_WhenProjectHasNoReferences_ReturnEmptyList() { var testProj = TestPathHelper.GetTestProjectPath("H"); var references = NodeFinder.GetProjectReferencePaths(testProj); references.ShouldBeEmpty(); }
public void GetVersionNodeValue_ForAssemblyVersion_ReturnAssemblyVersionString() { var testProj = TestPathHelper.GetTestProjectPath("A"); var version = NodeFinder.GetVersionNodeValue(testProj, VersionNode.AssemblyVersion); version.ValueUnsafe().ShouldBe("1.0.1"); }
public void GetProjectReferencePaths_WhenProjectHasTwoReferences_ReturnListWithTwoReferences() { var testProj = TestPathHelper.GetTestProjectPath("C_AB"); var references = NodeFinder.GetProjectReferencePaths(testProj).ToList(); references[0].Contains("A.csproj").ShouldBeTrue(); references[1].Contains("B.csproj").ShouldBeTrue(); }
public void GetVersionNodeValue_WhenProjectNotPackageProject_ReturnNone() { var testProj = TestPathHelper.GetTestProjectPath("H"); var version = NodeFinder.GetVersionNodeValue(testProj, VersionNode.Version); var assemblyVersion = NodeFinder.GetVersionNodeValue(testProj, VersionNode.AssemblyVersion); version.IsNone.ShouldBeTrue(); assemblyVersion.IsNone.ShouldBeTrue(); }
public void Set_ChangeAssemblyVersion_ShouldChangeToModifyProject() { var testProject = TestPathHelper.GetTestProjectPath("TO_MODIFY"); var newBuildNumber = Convert.ToInt32((DateTime.Now - DateTime.Today).TotalSeconds); var setAssemblyVersion = $"1.0.{newBuildNumber}"; NodeModifier.Set(testProject, VersionNode.AssemblyVersion, setAssemblyVersion); var assemblyVersion = NodeFinder.GetVersionNodeValue(testProject, VersionNode.AssemblyVersion); assemblyVersion.ValueUnsafe().ShouldBe(setAssemblyVersion); }
public void Save_ProjectWithoutAssemblyVersion_ShouldSaveVersionOnly() { var testProject = TestPathHelper.GetTestProjectPath("TO_MODIFY"); var newPatch = Convert.ToInt32((DateTime.Now - DateTime.Today).TotalSeconds); var project = new Project("TO_MODIFY", new Version(1, 1, newPatch, ""), Option <AssemblyVersion> .None, testProject); ProjectSaver.Save(project); var savedVersion = $"1.1.{newPatch}"; var notSavedAssemblyVersion = $"1.1.{newPatch}.0"; NodeFinder.GetVersionNodeValue(testProject, VersionNode.Version).ShouldBe(savedVersion); NodeFinder.GetVersionNodeValue(testProject, VersionNode.AssemblyVersion).ShouldNotBe(notSavedAssemblyVersion); }