Exemplo n.º 1
0
        public void TestSomething()
        {
            SimpleDependency dependency     = new SimpleDependency("Hello NetReflector");
            ObjectionStore   objectionStore = new ObjectionStore();

            objectionStore.AddInstanceForType(typeof(SimpleDependency), dependency);

            string serializedForm = @"<mySerializableType myProperty=""MyValue"" />";

            NetReflectorTypeTable typeTable = NetReflectorTypeTable.CreateDefault(new ObjectionNetReflectorInstantiator(objectionStore));

            SerializableType deserialized = (SerializableType)NetReflector.Read(serializedForm, typeTable);

            Assert.AreEqual("MyValue", deserialized.MyProperty);
            Assert.IsNotNull("Hello NetReflector", deserialized.DependencyObject.Message);
        }
 public void ShouldReturnInstanceRegisteredByType()
 {
     store.AddInstanceForType(typeof(TestInterface), testObject);
     Assert.AreSame(testObject, store.GetByType(typeof(TestInterface)));
 }