Example #1
0
        private HamlSpec GetHamlSpec(string groupName, KeyValuePair <string, object> test)
        {
            var properties = GetDictionary(test.Value);
            var result     = new HamlSpec
            {
                GroupName    = groupName,
                TestName     = test.Key,
                Haml         = properties["haml"].ToString(),
                ExpectedHtml = properties["html"].ToString()
            };

            if (properties.ContainsKey("config"))
            {
                result.Format = GetDictionary(properties["config"])["format"].ToString();
            }
            if (properties.ContainsKey("nHamlIgnored"))
            {
                result.NHamlIgnored = Boolean.Parse(properties["nHamlIgnored"].ToString());
            }
            if (properties.ContainsKey("locals"))
            {
                result.Locals = GetDictionary(properties["locals"]);
            }

            return(result);
        }
Example #2
0
        private HamlSpec GetHamlSpec(string groupName, KeyValuePair<string, object> test)
        {
            var properties = GetDictionary(test.Value);
            var result = new HamlSpec
            {
                GroupName = groupName,
                TestName = test.Key,
                Haml = properties["haml"].ToString(),
                ExpectedHtml = properties["html"].ToString()
            };

            if (properties.ContainsKey("config"))
            {
                result.Format = GetDictionary(properties["config"])["format"].ToString();
            }
            if (properties.ContainsKey("nHamlIgnored"))
            {
                result.NHamlIgnored = Boolean.Parse(properties["nHamlIgnored"].ToString());

            }
            if (properties.ContainsKey("locals"))
            {
                result.Locals = GetDictionary(properties["locals"]);
            }

            return result;
        }
Example #3
0
        private void ExecuteSingleTest(HamlSpec test)
        {
            var template = CreateTemplate(test.Haml);
            var output = new StringWriter();
            output.NewLine = "\n";
            template.Render(output, GetHtmlVersion(test.Format), test.Locals);

            var message = string.Format("{0} - {1}\n\"{2}\"", test.GroupName, test.TestName, test.Haml);
            Assert.That(output.ToString(), Is.EqualTo(test.ExpectedHtml), message);
        }
Example #4
0
        private void ExecuteSingleTest(HamlSpec test)
        {
            var template = CreateTemplate(test.Haml);
            var output   = new StringWriter();

            output.NewLine = "\n";
            template.Render(output, GetHtmlVersion(test.Format), test.Locals);

            var message = string.Format("{0} - {1}\n\"{2}\"", test.GroupName, test.TestName, test.Haml);

            Assert.That(output.ToString(), Is.EqualTo(test.ExpectedHtml), message);
        }