// passes here, but ...
xw.WriteValue ("foo");
// rejected here, unlike XamlXmlWriter.
- //
- // Basically, assume that no content could be written
- // for an object member within XamlObjectWriter.
xw.WriteEndMember ();
}
[Test]
[ExpectedException (typeof (XamlDuplicateMemberException))]
- [Category ("NotWorking")]
public void DuplicateAssignment2 ()
{
var xw = new XamlObjectWriter (sctx, null);
[Test]
// This behavior is different from XamlXmlWriter. Compare to XamlXmlWriterTest.WriteValueList().
+ [Category ("NotWorking")] // not worthy of passing
public void WriteValueList ()
{
var xw = new XamlObjectWriter (sctx, null);
}
[Test]
- [Category ("NotWorking")]
+ [Category ("NotWorking")] // not worthy of passing
public void StartMemberBeforeNamespace ()
{
var xw = new XamlObjectWriter (sctx, null);
}
[Test]
- [Category ("NotWorking")]
public void GetObjectOnIntValue ()
{
var xw = new XamlObjectWriter (sctx, null);
xw.WriteEndObject ();
}
- // use case based tests.
+ // extra use case based tests.
+
+ [Test]
+ public void WriteEx_Type_WriteString ()
+ {
+ var ow = new XamlObjectWriter (sctx);
+ ow.WriteNamespace (new NamespaceDeclaration (XamlLanguage.Xaml2006Namespace, "x"
+ ));
+ ow.WriteStartObject (XamlLanguage.Type);
+ ow.WriteStartMember (XamlLanguage.PositionalParameters);
+ ow.WriteValue ("x:Int32");
+ ow.Close ();
+ Assert.AreEqual (typeof (int), ow.Result, "#1");
+ }
+
+ [Test]
+ public void WriteEx_Type_WriteType ()
+ {
+ var ow = new XamlObjectWriter (sctx);
+ ow.WriteNamespace (new NamespaceDeclaration (XamlLanguage.Xaml2006Namespace, "x"
+ ));
+ ow.WriteStartObject (XamlLanguage.Type);
+ ow.WriteStartMember (XamlLanguage.PositionalParameters);
+ ow.WriteValue (typeof (int));
+ ow.Close ();
+ Assert.AreEqual (typeof (int), ow.Result, "#1");
+ }
+
+ // common use case based tests (to other readers/writers).
XamlReader GetReader (string filename)
{
}
[Test]
- [Category ("NotWorking")]
public void Write_Type ()
{
using (var xr = GetReader ("Type.xml")) {
}
[Test]
- [Category ("NotWorking")]
public void Write_Type2 ()
{
var obj = typeof (MonoTests.System.Xaml.TestClass1);
}
}
+ [Test]
+ public void Write_GuidFactoryMethod ()
+ {
+ var obj = Guid.Parse ("9c3345ec-8922-4662-8e8d-a4e41f47cf09");
+ using (var xr = GetReader ("GuidFactoryMethod.xml")) {
+ var des = XamlServices.Load (xr);
+ Assert.AreEqual (obj, des, "#1");
+ }
+ }
+
[Test]
[ExpectedException (typeof (XamlObjectWriterException))] // cannot resolve the StaticExtension value.
- [Category ("NotWorking")]
public void Write_StaticExtension ()
{
var obj = new StaticExtension ("FooBar");
}
[Test]
- [Category ("NotWorking")]
public void Write_ListType ()
{
var obj = new List<Type> (new Type [] {typeof (int), typeof (Dictionary<Type, XamlType>)}) { Capacity = 2 };
}
[Test]
- [Category ("NotWorking")]
public void Write_DictionaryInt32String ()
{
var dic = new Dictionary<int,string> ();
}
[Test]
- [Category ("NotWorking")]
public void Write_DictionaryStringType ()
{
var dic = new Dictionary<string,Type> ();
}
[Test]
- [Category ("NotWorking")]
public void Write_ArgumentAttributed ()
{
//var obj = new ArgumentAttributed ("foo", "bar");
}
[Test]
- [Category ("NotWorking")]
public void Write_MyExtension3 ()
{
//var obj = new MyExtension3 () { Foo = typeof (int), Bar = "v2"};
}
[Test]
- [Category ("NotWorking")]
public void Write_PropertyDefinition ()
{
//var obj = new PropertyDefinition () { Modifier = "protected", Name = "foo", Type = XamlLanguage.String };
Assert.AreEqual (XamlLanguage.String, des.Type, "#3");
}
}
+
+ [Test]
+ [Ignore ("this still does not give successful deserialization result - should there be any way?")]
+ public void Write_StaticExtensionWrapper ()
+ {
+ //var obj = new StaticExtensionWrapper () { Param = new StaticExtension ("Foo") };
+ using (var xr = GetReader ("StaticExtensionWrapper.xml")) {
+ var des = (StaticExtensionWrapper) XamlServices.Load (xr);
+ Assert.IsNotNull (des.Param, "#1");
+ Assert.AreEqual ("Foo", des.Param.Member, "#2");
+ }
+ }
+
+ [Test]
+ [Ignore ("this still does not give successful deserialization result - should there be any way?")]
+ public void Write_TypeExtensionWrapper ()
+ {
+ //var obj = new TypeExtensionWrapper () { Param = new TypeExtension ("Foo") };
+ using (var xr = GetReader ("TypeExtensionWrapper.xml")) {
+ var des = (TypeExtensionWrapper) XamlServices.Load (xr);
+ Assert.IsNotNull (des.Param, "#1");
+ // TypeName was not serialized into xml, hence deserialized as empty.
+ Assert.AreEqual (String.Empty, des.Param.TypeName, "#2");
+ }
+ }
}
}