예제 #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);
        }
예제 #4
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\">\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);
		}