public void ObfuscateWithoutUserNameInStacktrace() { Constants.UserName = "******"; string path = $"C:\\no.user.name\\some\\path"; string obfuscateResult = ErrorLogHelper.ObfuscateUserName(path); Assert.AreEqual(obfuscateResult, path); }
public void ObfuscateUserNameInStacktrace() { Constants.UserName = "******"; string pathWithUserName = $"C:\\{Constants.UserName}\\some\\path"; string expectedPath = $"C:\\USER\\some\\path"; string obfuscateResult = ErrorLogHelper.ObfuscateUserName(pathWithUserName); Assert.AreEqual(obfuscateResult, expectedPath); }
public void ObfuscateUserNameWhenStringNullOrEmpty() { // Check obfuscation a username when the path is empty. string path = ""; string obfuscateResult = ErrorLogHelper.ObfuscateUserName(path); Assert.AreEqual(obfuscateResult, path); // Check obfuscation a username when the path is null. obfuscateResult = ErrorLogHelper.ObfuscateUserName(null); Assert.IsNull(obfuscateResult); }
public void ObfuscateUserNameWhenUserNameNullOrEmpty() { // Check obfuscation a username when the username is null. Constants.UserName = null; string path = $"C:\\{Constants.UserName}\\some\\path"; string obfuscateResult = ErrorLogHelper.ObfuscateUserName(path); Assert.AreEqual(obfuscateResult, path); // Check obfuscation a username when the username is empty. Constants.UserName = string.Empty; path = $"C:\\{Constants.UserName}\\some\\path"; obfuscateResult = ErrorLogHelper.ObfuscateUserName(path); Assert.AreEqual(obfuscateResult, path); }