public void additional_namespaces_can_be_specified() { var writer = new XamlWriter(_sw, new XamlWriterSettings(cfg => cfg.AddReference("foo", "Acme.SuperNameSpace", "Acme.SuperAssembly"))); writer.Dispose(); GeneratedOutput.Should().Contain(@"xmlns:foo=""clr-namespace:Acme.SuperNameSpace;assembly=Acme.SuperAssembly"""); }
public void root_control_can_be_overridden() { var writer = new XamlWriter(_sw, new XamlWriterSettings(cfg => cfg.SetRootElement("StackPanel"))); writer.Dispose(); GeneratedOutput.Should().StartWith("<StackPanel"); }
public void root_control_can_be_custom_control() { var writer = new XamlWriter(_sw, new XamlWriterSettings(cfg => cfg.AddReference("foo", "FooNameSpace").SetRootElement("foo:FooPanel"))); writer.Dispose(); GeneratedOutput.Should().StartWith("<foo:FooPanel"); }
public void default_generates_empty_content_control() { var writer = new XamlWriter(_sw); writer.Dispose(); GeneratedOutput.Should().StartWith("<ContentControl"); }
public void add_nested_element() { var writer = new XamlWriter(_sw); writer.RegisterReference("query", "abc"); writer.StartElement("query:Viewer", w => w.AddAttribute("Value", "{Binding}")); writer.Dispose(); GeneratedOutput.Should().Contain(" <query:Viewer"); }