public void UndoRedoProperties()
        {
            BdWithNestedWrapper<SimpleBusinessObject, BindableWrapper<SimpleBusinessObject>> bindable =
                new BdWithNestedWrapper<SimpleBusinessObject,BindableWrapper<SimpleBusinessObject>>
                    (new SimpleBusinessObject(), new BindableWrapper<SimpleBusinessObject>(new SimpleBusinessObject()));

            bindable.Data.NestedWrapper.Data.BusinessObj.Name = "whatever";
            bindable.Data.NestedWrapper.Data.BusinessObj.Name = "somethingelse";

            bindable.Undo();

            Assert.AreEqual(bindable.Data.NestedWrapper.Data.BusinessObj.Name, "whatever");

            bindable.Redo();

            Assert.AreEqual(bindable.Data.NestedWrapper.Data.BusinessObj.Name, "somethingelse");

            bindable.Data.BusinessObj.Name = "asdf";

            bindable.Data.BusinessObj.Name = "qwerty";

            bindable.Undo();

            Assert.AreEqual(bindable.Data.BusinessObj.Name, "asdf");

            bindable.Redo();

            Assert.AreEqual(bindable.Data.BusinessObj.Name, "qwerty");
        }
 public void CreateBindables()
 {
     BdWithNestedWrapper<SimpleBusinessObject, BindableWrapper<SimpleBusinessObject>> bindable =
         new BdWithNestedWrapper<SimpleBusinessObject,BindableWrapper<SimpleBusinessObject>>
             (new SimpleBusinessObject(), new BindableWrapper<SimpleBusinessObject>(new SimpleBusinessObject()));
     Assert.IsNotNull(bindable);
 }
        public void ChangeProperties()
        {
            BdWithNestedWrapper<SimpleBusinessObject, BindableWrapper<SimpleBusinessObject>> bindable =
                new BdWithNestedWrapper<SimpleBusinessObject,BindableWrapper<SimpleBusinessObject>>
                    (new SimpleBusinessObject(), new BindableWrapper<SimpleBusinessObject>(new SimpleBusinessObject()));

            bindable.Data.NestedWrapper.Data.BusinessObj.Name = "asdf";
            Assert.AreEqual(bindable.Data.NestedWrapper.Data.BusinessObj.Name, "asdf");
        }
Ejemplo n.º 4
0
        private static void SendBindableWrapperNestedWrapper(BindableObjectsDeserializer bod)
        {
            BdWithNestedWrapper<SimpleBusinessObject, BindableWrapper<SimpleBusinessObject>> bindable =
                new BdWithNestedWrapper<SimpleBusinessObject, BindableWrapper<SimpleBusinessObject>>
                    (new SimpleBusinessObject(), new BindableWrapper<SimpleBusinessObject>(new SimpleBusinessObject()));

            bindable.Data.NestedWrapper.Data.BusinessObj.Name = "asdf";

            bod.ReadBindableNestedWrapper(bindable);

            Console.WriteLine("Server called");
        }
        public void SerializationTest()
        {
            BdWithNestedWrapper<SimpleBusinessObject, BindableWrapper<SimpleBusinessObject>> bindable =
                new BdWithNestedWrapper<SimpleBusinessObject, BindableWrapper<SimpleBusinessObject>>
                    (new SimpleBusinessObject(), new BindableWrapper<SimpleBusinessObject>(new SimpleBusinessObject()));

            bindable.Data.NestedWrapper.Data.BusinessObj.Name = "asdf";

            MemoryStream stream = new MemoryStream();
            BinaryFormatter formatter = new BinaryFormatter();
            formatter.Serialize(stream, bindable);
            stream.Position = 0;

            object deserializedObject = formatter.Deserialize(stream);
            Assert.IsNotNull(deserializedObject);
            BdWithNestedWrapper<SimpleBusinessObject, BindableWrapper<SimpleBusinessObject>> deserializedBindable =
            (BdWithNestedWrapper<SimpleBusinessObject, BindableWrapper<SimpleBusinessObject>>) deserializedObject;

            Assert.IsNotNull(deserializedBindable);
            Assert.AreEqual(deserializedBindable.Data.NestedWrapper.Data.BusinessObj.Name, "asdf");
        }