Skip to content

Instantly share code, notes, and snippets.

@fingers10
Created February 9, 2025 15:52
Show Gist options
  • Save fingers10/edc1108390ef4363d204977c88fc8b82 to your computer and use it in GitHub Desktop.
Save fingers10/edc1108390ef4363d204977c88fc8b82 to your computer and use it in GitHub Desktop.
Processing Test File
static async Task ProcessWithRegex(string filePath)
{
var lines = await File.ReadAllLinesAsync(filePath);
var updatedLines = new StringBuilder();
var converted = false;
foreach (var line in lines)
{
if (line.Contains(".Should()."))
{
var result = ConvertFluentAssertionsToXUnit(line);
updatedLines.AppendLine(result);
converted = true;
}
else
{
updatedLines.AppendLine(line);
}
}
if (converted)
await File.WriteAllTextAsync(filePath, updatedLines.ToString());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment