public void TestCall( ) { Guid id = new Guid( GuidString ); string content = @"<?xml version=""1.0"" encoding=""utf-8""?>" + @"<rb>" + @" <object type=""Rb.ComponentXmlLoader.Tests.TestLoader+Root"" id=""" + GuidString + @""">" + @" <method objectId=""" + GuidString + @""" call=""Call""/>" + @" <method objectId=""" + GuidString + @""" call=""Call"">" + @" <parameters>" + @" <string value=""hello""/>" + @" </parameters>" + @" </method>" + @" </object>" + @"</rb>" + ""; Loader loader = new Loader( ); byte[] contentBytes = System.Text.Encoding.ASCII.GetBytes( content ); Definition = 0; ComponentLoadParameters parameters = new ComponentLoadParameters( ); loader.Load( MemorySource( contentBytes ), parameters ); Assert.IsTrue( parameters.Objects.ContainsKey( id ) ); object obj = parameters.Objects[ id ]; Assert.IsTrue( obj is Root ); }
public void TestDynamicProperties( ) { string content = @"<?xml version=""1.0"" encoding=""utf-8""?>" + @"<rb>" + @" <object type=""Rb.Core.Components.Component"">" + @" <int value=""10"" dynProperty=""intValue""/>" + @" <string value=""badgers"" dynProperty=""strValue""/>" + @" </object>" + @"</rb>" + ""; byte[] contentBytes = System.Text.Encoding.ASCII.GetBytes( content ); object result = new Loader( ).Load( MemorySource( contentBytes ), new ComponentLoadParameters( ) ); Assert.AreEqual( ( ( ISupportsDynamicProperties )result ).Properties[ "intValue" ], 10 ); Assert.AreEqual( ( ( ISupportsDynamicProperties )result ).Properties[ "strValue" ], "badgers" ); }