Exemplo n.º 1
0
        public void GetService()
        {
            var obj = new TestValueSerialized();
            var xr  = new XamlObjectReader(obj);

            while (!xr.IsEof)
            {
                xr.Read();
            }
            Assert.IsNotNull(Context, "premise#1");
            GetServiceCoreReader();

            Context = null;
            var ctx = new XamlSchemaContext();
            var xw  = new XamlObjectWriter(ctx);
            var xt  = ctx.GetXamlType(obj.GetType());

            xw.WriteStartObject(xt);
            xw.WriteStartMember(XamlLanguage.Initialization);
            xw.WriteValue("v");
            xw.WriteEndMember();
            xw.Close();
            Assert.IsNotNull(Provider, "premise#2");              // cannot get Context, it does not give IValueSerializerContext in the test.
            GetServiceCoreWriter();
        }
        void SetupReaderService()
        {
            var obj = new TestValueSerialized();
            var xr  = new XamlObjectReader(obj);

            while (!xr.IsEof)
            {
                xr.Read();
            }
        }
        void SetupReaderService()
        {
            Context = null;
            var obj = new TestValueSerialized();
            var xr  = new XamlObjectReader(obj);

            while (!xr.IsEof && Context == null)
            {
                xr.Read();
            }
            Assert.IsNotNull(Context, "SetupReader #1");
        }
        void SetupWriterService()
        {
            var obj = new TestValueSerialized();
            var ctx = new XamlSchemaContext();
            var xw  = new XamlObjectWriter(ctx);
            var xt  = ctx.GetXamlType(obj.GetType());

            xw.WriteStartObject(xt);
            xw.WriteStartMember(XamlLanguage.Initialization);
            xw.WriteValue("v");
            xw.WriteEndMember();
            xw.Close();
        }