Пример #1
0
        public void ResourceLabel()
        {
            var hh = new FakeHtmlHelper<Foo>();

            //Pegou do nome da propriedade
            var html = hh.WResourceLabelFor(m => m.Name);
            Assert.AreEqual("<label for=\"Name\">Name</label>", html.ToHtmlString());

            //Pegou do DisplayAttribute
            html = hh.WResourceLabelFor(m => m.Age);
            Assert.AreEqual("<label for=\"Age\">Idade</label>", html.ToHtmlString());

            WResourceLabelExtensions.SetResourceManager(TestResource.ResourceManager);
            //Pegou do Resource
            html = hh.WResourceLabelFor(m => m.Name);
            Assert.AreEqual("<label for=\"Name\">Peguei do resource</label>", html.ToHtmlString());
        }