+2010-05-17 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XamlWriterStateManager.cs : on object writer, reject more write
+ namespace order. (I should really unuse it for object writer.)
+ * XamlObjectWriter.cs : result is set at end object. Do not reject
+ non-collection in this writer. I'm totally no idea why it should
+ not do so though.
+
2010-04-26 Atsushi Enomoto <atsushi@ximian.com>
* XamlMember.cs : hack GetHashCode().
var obj = objects.Pop ();
if (members.Count > 0)
contents.Add (obj);
+ if (objects.Count == 0)
+ result = obj;
}
public override void WriteGetObject ()
manager.GetObject ();
var xm = members.Peek ();
- if (!xm.Type.IsCollection)
- throw new XamlObjectWriterException (String.Format ("WriteGetObject method can be invoked only when current member '{0}' is of collection type", xm.Name));
+ // see GetObjectOnNonNullString() test
+ //if (!xm.Type.IsCollection)
+ // throw new XamlObjectWriterException (String.Format ("WriteGetObject method can be invoked only when current member '{0}' is of collection type", xm.Name));
var obj = xm.Invoker.GetValue (objects.Peek ());
if (obj == null)
{
objects.Push (obj);
object_instantiated = true;
- if (objects.Count == 1)
- result = objects.Peek ();
arguments.Clear ();
factory_method = null;
}
public void Namespace ()
{
- if (!allow_ns_at_value && state == XamlWriteState.ValueWritten)
+ if (!allow_ns_at_value && (state == XamlWriteState.ValueWritten || state == XamlWriteState.ObjectStarted))
throw CreateError (String.Format ("Namespace declarations cannot be written at {0} state", state));
ns_pushed = true;
}
+2010-05-17 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XamlObjectWriterTest.cs : fix and enable some tests.
+
2010-04-26 Atsushi Enomoto <atsushi@ximian.com>
* XamlObjectReaderTest.cs : more test use cases.
[Test]
[ExpectedException (typeof (XamlObjectWriterException))] // This is also very different, requires exactly opposite namespace output manner to XamlXmlWriter (namespace first, object follows).
- [Category ("NotWorking")]
public void StartMemberAfterNamespace ()
{
var xw = new XamlObjectWriter (sctx, null);
}
[Test]
- // String is not treated as a collection on XamlXmlWriter, while this XamlObjectReader does.
- [Category ("NotWorking")]
+ // String is not treated as a collection on XamlXmlWriter, while this XamlObjectWriter does.
public void GetObjectOnNonNullString ()
{
var xw = new XamlObjectWriter (sctx, null);
xw.WriteStartObject (xt3);
+ Assert.IsNull (xw.Result, "#1");
xw.WriteStartMember (xt3.GetMember ("TestProp3"));
xw.WriteGetObject ();
+ Assert.IsNull (xw.Result, "#2");
}
[Test]
xw.WriteStartMember (new XamlMember (typeof (Foo).GetProperty ("Bar"), sctx));
xw.WriteGetObject ();
xw.Close ();
- // FIXME: enable it once we got generic type output fixed.
- //Assert.AreEqual (xml, sw.ToString ().Replace ('"', '\''), "#1");
}
[Test]