示例#1
0
        public void ObfuscateWithoutUserNameInStacktrace()
        {
            Constants.UserName = "******";
            string path            = $"C:\\no.user.name\\some\\path";
            string obfuscateResult = ErrorLogHelper.ObfuscateUserName(path);

            Assert.AreEqual(obfuscateResult, path);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }