Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,38 @@ public void GetTfsNodeStructureTool_WithDifferentAreaPath()

}

[TestMethod(), TestCategory("L0")]
public void GetNewNodeName_WithCaseDifferenceInSourcePath_AppliesMappingConsistently()
{
var options = new TfsNodeStructureToolOptions();
options.Enabled = true;
options.Areas = new NodeOptions()
{
Mappings = [
new() { Match = @"^SourceProject\\PUL", Replacement = "TargetProject\\test\\PUL" }
]
};
var nodeStructure = GetTfsNodeStructureTool(options);

nodeStructure.ApplySettings(new TfsNodeStructureToolSettings
{
SourceProjectName = "SourceProject",
TargetProjectName = "TargetProject",
FoundNodes = new Dictionary<string, bool>
{
{ @"TargetProject\Area\test\PUL", true }
}
});

// Source path uses different casing than the Match pattern — must still apply replacement
const string sourceNodeName = @"sourceproject\pul";
const TfsNodeStructureType nodeStructureType = TfsNodeStructureType.Area;

var newNodeName = nodeStructure.GetNewNodeName(sourceNodeName, nodeStructureType);

Assert.AreEqual(@"TargetProject\test\PUL", newNodeName);
}

[TestMethod, TestCategory("L0")]
public void TestFixAreaPath_WhenNoAreaPathOrIterationPath_DoesntChangeQuery()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public string GetNewNodeName(string sourceNodePath, TfsNodeStructureType nodeStr
if (Regex.IsMatch(sourceNodePath, mapper.Match, RegexOptions.IgnoreCase))
{
Log.LogDebug("NodeStructureEnricher.GetNewNodeName::Mappers::{key}::Match", mapper.Match);
string replacement = Regex.Replace(sourceNodePath, mapper.Match, mapper.Replacement);
string replacement = Regex.Replace(sourceNodePath, mapper.Match, mapper.Replacement, RegexOptions.IgnoreCase);
Log.LogDebug("NodeStructureEnricher.GetNewNodeName::Mappers::{key}::replaceWith({replace})", mapper.Match, replacement);
return replacement;
}
Expand All @@ -130,7 +130,7 @@ public string GetNewNodeName(string sourceNodePath, TfsNodeStructureType nodeStr
throw new NodePathNotAnchoredException($"This path is not anchored in the source project name: {sourceNodePath}");
}

return Regex.Replace(sourceNodePath, lastResortRule.Key, lastResortRule.Value);
return Regex.Replace(sourceNodePath, lastResortRule.Key, lastResortRule.Value, RegexOptions.IgnoreCase);
}

private KeyValuePair<string, string> GetLastResortRemappingRule()
Expand Down
Loading