コード例 #1
0
        public void Email_is_obfuscated_if_user_is_authenticated(string input, string expectedLinkText)
        {
            var protector = new EmailProtector();

            var result = protector.ProtectEmailAddresses(input, true);

            Assert.Equal(@$ "<p>Before <a href=" "{OBFUSCATED_MAILTO + OBFUSCATED_EMAIL_ADDRESS}" ">{expectedLinkText}</a> after</p>", result);
        }
コード例 #2
0
        public void Null_or_empty_is_returned_unaltered(string input)
        {
            var protector = new EmailProtector();

            var result = protector.ProtectEmailAddresses(input, true);

            Assert.Equal(input, result);
        }
コード例 #3
0
        public void Email_is_protected_if_user_is_unauthenticated(string input)
        {
            var protector = new EmailProtector();

            var result = protector.ProtectEmailAddresses(input, false);

            Assert.Equal(@"<p>Before (email address available – please <a href=""/account/sign-in"">sign in</a>) after</p>", result);
        }