Esempio n. 1
0
        public void EmptyAliasListJustPassesThroughStrings()
        {
            var subject = new AliasList();

            Assert.AreEqual("foo", subject.GetCanonicalNameFor("foo"));
            Assert.AreEqual("foo", subject.GetDisplayNameFor("foo"));
        }
Esempio n. 2
0
        public void CanAddAndFetchCanonicalName()
        {
            var subject = new AliasList();

            subject.AddAlias("hiro.protagonist", "Hiro Protagonist", new[] { "The Deliverator", "GreatestSwordsman" });

            Assert.AreEqual("hiro.protagonist", subject.GetCanonicalNameFor("Hiro Protagonist"),
                            "should convert display name to canonical name");
            Assert.AreEqual("hiro.protagonist", subject.GetCanonicalNameFor("hiro.protagonist"),
                            "should pass through canonical name");
            Assert.AreEqual("hiro.protagonist", subject.GetCanonicalNameFor("The Deliverator"),
                            "other aliases should also work");
            Assert.AreEqual("hiro.protagonist", subject.GetCanonicalNameFor("GreatestSwordsman"),
                            "more than one other aliases should also work");
            Assert.AreEqual("hiro.protagonist", subject.GetCanonicalNameFor("HIRO.PROTAGONIST"),
                            "should canonicalize canonical name by case");
            Assert.AreEqual("hiro.protagonist", subject.GetCanonicalNameFor("HIRO PROTAGONIST"),
                            "should not be case-sensitive");
        }