示例#1
0
        protected void AssertCanvasDesignerOutput(string expectedXaml, DesignContext context)
        {
            expectedXaml =
                "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n" +
                ("<Canvas xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" " +
                 "xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" " +
                 "xmlns:t=\"" + DesignerTestsNamespace + "\">\n" + expectedXaml.Trim())
                .Replace("\r", "").Replace("\n", "\n  ")
                + "\n</Canvas>";

            StringWriter  stringWriter = new StringWriter();
            XmlTextWriter xmlWriter    = new XmlTextWriter(stringWriter);

            xmlWriter.Formatting = Formatting.Indented;
            context.Save(xmlWriter);

            string actualXaml = stringWriter.ToString().Replace("\r", "");;

            if (expectedXaml != actualXaml)
            {
                Debug.WriteLine("expected xaml:");
                Debug.WriteLine(expectedXaml);
                Debug.WriteLine("actual xaml:");
                Debug.WriteLine(actualXaml);
            }
            Assert.AreEqual(expectedXaml, actualXaml);
        }
示例#2
0
		protected void AssertCanvasDesignerOutput(string expectedXaml, DesignContext context, params String[] additionalXmlns)
		{
			string canvasStartTag =
				"<Canvas xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" " +
				 "xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" " +
				 "xmlns:t=\"" + DesignerTestsNamespace + "\"";

			
			foreach(string ns in additionalXmlns) {
				canvasStartTag += " " + ns;
			}

			expectedXaml = canvasStartTag + ">\n" + expectedXaml.Trim();
			
			expectedXaml =
				"<?xml version=\"1.0\" encoding=\"utf-16\"?>\n" +
				expectedXaml.Replace("\r", "").Replace("\n", "\n  ")
				+ "\n</Canvas>";
			
			StringWriter stringWriter = new StringWriter();
			XmlTextWriter xmlWriter = new XmlTextWriter(stringWriter);
			xmlWriter.Formatting = Formatting.Indented;
			context.Save(xmlWriter);
			
			string actualXaml = stringWriter.ToString().Replace("\r", "");;
			if (expectedXaml != actualXaml) {
				Debug.WriteLine("expected xaml:");
				Debug.WriteLine(expectedXaml);
				Debug.WriteLine("actual xaml:");
				Debug.WriteLine(actualXaml);
			}
			Assert.AreEqual(expectedXaml, actualXaml);
		}
        protected void AssertDesignerOutput(string expectedXaml, DesignContext context)
        {
            StringWriter  stringWriter = new StringWriter();
            XmlTextWriter xmlWriter    = new XmlTextWriter(stringWriter);

            xmlWriter.Formatting = Formatting.Indented;
            context.Save(xmlWriter);

            string actualXaml = stringWriter.ToString().Replace("\r", "");;

            if (expectedXaml != actualXaml)
            {
                Debug.WriteLine("expected xaml:");
                Debug.WriteLine(expectedXaml);
                Debug.WriteLine("actual xaml:");
                Debug.WriteLine(actualXaml);
            }
            Assert.AreEqual(expectedXaml, actualXaml);
        }
		protected void AssertCanvasDesignerOutput(string expectedXaml, DesignContext context)
		{
			expectedXaml =
				"<?xml version=\"1.0\" encoding=\"utf-16\"?>\n" +
				("<Canvas xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" " +
				 "xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\">\n" + expectedXaml.Trim())
				.Replace("\r", "").Replace("\n", "\n  ")
				+ "\n</Canvas>";
			
			StringWriter stringWriter = new StringWriter();
			XmlTextWriter xmlWriter = new XmlTextWriter(stringWriter);
			xmlWriter.Formatting = Formatting.Indented;
			context.Save(xmlWriter);
			
			string actualXaml = stringWriter.ToString().Replace("\r", "");;
			if (expectedXaml != actualXaml) {
				Debug.WriteLine("expected xaml:");
				Debug.WriteLine(expectedXaml);
				Debug.WriteLine("actual xaml:");
				Debug.WriteLine(actualXaml);
			}
			Assert.AreEqual(expectedXaml, actualXaml);
		}
示例#5
0
 /// <summary>
 /// Saves the designer content into the specified XmlWriter.
 /// </summary>
 public void SaveDesigner(XmlWriter writer)
 {
     _designContext.Save(writer);
 }
示例#6
0
		protected void AssertDesignerOutput(string expectedXaml, DesignContext context)
		{
			StringWriter stringWriter = new StringWriter();
			XmlTextWriter xmlWriter = new XmlTextWriter(stringWriter);
			xmlWriter.Formatting = Formatting.Indented;
			context.Save(xmlWriter);
			
			string actualXaml = stringWriter.ToString().Replace("\r", "");;
			if (expectedXaml != actualXaml) {
				Debug.WriteLine("expected xaml:");
				Debug.WriteLine(expectedXaml);
				Debug.WriteLine("actual xaml:");
				Debug.WriteLine(actualXaml);
			}
			Assert.AreEqual(expectedXaml, actualXaml);
		}