Add unit test for ExtractFileName
ADD
WalletWasabi.Tests/UnitTests/LoggerTests.cs
+using NBitcoin;
+using NBitcoin.Payment;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Text;
+using WalletWasabi.Logging;
+using Xunit;
+
+namespace WalletWasabi.Tests.UnitTests
+{
+ public class LoggerTests
+ {
+ [Theory]
+ [InlineData("./Program.cs")]
+ [InlineData("\\Program.cs")]
+ [InlineData("Program.cs")]
+ [InlineData("C:\\User\\user\\Github\\WalletWasabi\\WalletWasabi.Gui\\Program.cs")]
+ [InlineData("/mnt/C/User/user/Github/WalletWasabi/WalletWasabi.Gui/Program.cs")]
+ [InlineData("~/Github/WalletWasabi/WalletWasabi.Gui/Program.cs")]
+ public void EndPointParserTests(string path)
+ {
+ var sourceFileName = Logger.ExtractFileName(path);
+ Assert.Equal("Program", sourceFileName);
+ }
+ }
+}
\ No newline at end of file

MODIFY
WalletWasabi/Logging/Logger.cs
WalletWasabi/Logging/Logger.cs
@@ -235,7 +235,7 @@ namespace WalletWasabi.Logging
// In Windows and Linux that string is a valid path and that means Path.GetFileNameWithoutExtension
// can extract the file name but in the case of OSX the same string is not a valid path so, it assumes
// the whole string is the file name.
- private static string ExtractFileName(string callerFilePath)
+ internal static string ExtractFileName(string callerFilePath)
{
var lastSeparatorIndex = callerFilePath.LastIndexOf("\\");
if (lastSeparatorIndex == -1)

Add unit test for ExtractFileName