Пример #1
0
        public void FormatUserNameTest()
        {
            var nameFormatter = new NameFormatter();
            var homer         = new HumanName("Homer", "Simpson", "Jay");
            var homerRu       = new HumanName("Гомер", "Симпсон", "Джей");
            var email         = "*****@*****.**";

            Assert.Equal(
                "homer_js",
                nameFormatter.FormatUserName("[FIRSTNAME]_[O][L]", homer, email, false)
                );

            Assert.Equal(
                "simpson_gd",
                nameFormatter.FormatUserName("[LASTNAME]_[F][O]", homerRu, email, false)
                );

            Assert.Equal(
                email,
                nameFormatter.FormatUserName("[LASTNAME]_[F][O]", homer, email, true)
                );

            Assert.Equal(
                "homer_at_simpsons_net",
                nameFormatter.FormatUserName("[EMAIL]", homer, email, false)
                );
        }