public void transform_simple_attribute_noop() { var doc = new HxlDocument(); var attr = doc.CreateAttribute("class"); attr.Value = "no expressions"; var node = ConvertNode(attr); Assert.Same(attr, node); }
public void transform_simple_attribute_expression_syntax() { var doc = new HxlDocument(); var attr = doc.CreateAttribute("class"); attr.Value = "no $myExpressions"; var expected = "myvar = global::Carbonfrost.Commons.Hxl.HxlAttribute.Create(\"class\", (__closure, __self__) => string.Concat((object) \"no \", (__closure.MyExpressions)));" + Environment.NewLine; var tw = new StringWriter(); ((HxlExpressionAttribute)ConvertNode(attr)).GetInitCode("myvar", null, tw); // new IndentedTextWriter(tw, " ")); string text = tw.ToString(); Assert.Equal(expected, text); }