Exemple #1
0
        public void TestAssignsStudlyCaps()
        {
            var rubyNamingConvention = new RubyNamingConvention();

            Helper.AssertTemplateResult(
                expected: ".foo.",
                template: "{% assign FoO = values %}.{{ fOo[0] }}.",
                anonymousObject: new { values = new[] { "foo", "bar", "baz" } },
                namingConvention: rubyNamingConvention);
            Helper.AssertTemplateResult(
                expected: ".bar.",
                template: "{% assign fOo = values %}.{{ fOO[1] }}.",
                anonymousObject: new { values = new[] { "foo", "bar", "baz" } },
                namingConvention: rubyNamingConvention);

            var csNamingConvention = new CSharpNamingConvention();

            Helper.AssertTemplateResult(
                expected: ".foo.",
                template: "{% assign Foo = values %}.{{ Foo[0] }}.",
                anonymousObject: new { values = new[] { "foo", "bar", "baz" } },
                namingConvention: csNamingConvention);
            Helper.AssertTemplateResult(
                expected: ".bar.",
                template: "{% assign fOo = values %}.{{ fOo[1] }}.",
                anonymousObject: new { values = new[] { "foo", "bar", "baz" } },
                namingConvention: csNamingConvention);
        }
Exemple #2
0
        public void TestRubyFullUpperCase()
        {
            RubyNamingConvention namingConvention = new RubyNamingConvention();

            Assert.AreEqual("id", namingConvention.GetMemberName("ID"));
            Assert.AreEqual("hellocruelworld", namingConvention.GetMemberName("HELLOCRUELWORLD"));
        }
Exemple #3
0
 static Template()
 {
     RegexTimeOut          = TimeSpan.FromSeconds(10);
     NamingConvention      = new RubyNamingConvention();
     FileSystem            = new BlankFileSystem();
     Tags                  = new Dictionary <string, Tuple <ITagFactory, Type> >();
     SafeTypeTransformers  = new Dictionary <Type, Func <object, object> >();
     ValueTypeTransformers = new Dictionary <Type, Func <object, object> >();
 }
Exemple #4
0
        public void TestRubyWithTurkishCulture()
        {
            using (CultureHelper.SetCulture("tr-TR"))
            {
                RubyNamingConvention namingConvention = new RubyNamingConvention();

                // in Turkish ID.ToLower() returns a localized i, and this fails
                Assert.AreEqual("id", namingConvention.GetMemberName("ID"));
            }
        }
        public void TestRubyWithTurkishCulture()
        {
            System.Threading.Thread.CurrentThread.CurrentCulture       =
                System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("tr-TR");

            RubyNamingConvention namingConvention = new RubyNamingConvention();

            // in Turkish ID.ToLower() returns a localized i, and this fails
            Assert.AreEqual("id", namingConvention.GetMemberName("ID"));
        }
Exemple #6
0
        public void TestRubyMoreComplexName()
        {
            RubyNamingConvention namingConvention = new RubyNamingConvention();

            Assert.AreEqual("hello_cruel_world", namingConvention.GetMemberName("HelloCruelWorld"));
        }
Exemple #7
0
        public void TestRubySimpleName()
        {
            RubyNamingConvention namingConvention = new RubyNamingConvention();

            Assert.AreEqual("test", namingConvention.GetMemberName("Test"));
        }
Exemple #8
0
        public void TestRubyComplexName()
        {
            var namingConvention = new RubyNamingConvention();

            Assert.AreEqual("hello_world", namingConvention.GetMemberName("HelloWorld"));
        }