Пример #1
0
        public void WhenNotifyingOnAnInstanceProperty_ThenAnEventIsFired()
        {
            var testObject    = new TestNotificationObject();
            var changeTracker = new PropertyChangeTracker(testObject);

            testObject.InstanceProperty = "newValue";

            Assert.IsTrue(changeTracker.ChangedProperties.Contains("InstanceProperty"));
        }
        public void WhenNotifyingOnAnInstanceProperty_ThenAnEventIsFired()
        {
            var testObject = new TestNotificationObject();
            var changeTracker = new PropertyChangeTracker(testObject);

            testObject.InstanceProperty = "newValue";

            Assert.IsTrue(changeTracker.ChangedProperties.Contains("InstanceProperty"));
        }
Пример #3
0
        public void NotificationObjectShouldBeDataContractSerializable()
        {
            var serializer = new System.Runtime.Serialization.DataContractSerializer(typeof(TestNotificationObject));
            var stream     = new System.IO.MemoryStream();

            var testObject = new TestNotificationObject();

            serializer.WriteObject(stream, testObject);

            stream.Seek(0, System.IO.SeekOrigin.Begin);

            var reconstitutedObject = serializer.ReadObject(stream) as TestNotificationObject;

            Assert.IsNotNull(reconstitutedObject);
        }
        public void NotificationObjectShouldBeDataContractSerializable()
        {
            var serializer = new System.Runtime.Serialization.DataContractSerializer(typeof (TestNotificationObject));
            var stream = new System.IO.MemoryStream();

            var testObject = new TestNotificationObject();

            serializer.WriteObject(stream, testObject);

            stream.Seek(0, System.IO.SeekOrigin.Begin);

            var reconstitutedObject = serializer.ReadObject(stream) as TestNotificationObject;

            Assert.IsNotNull(reconstitutedObject);
        }
    public void NotificationShouldBeXmlSerializable()
    {
      var serializer = new XmlSerializer(typeof(TestNotificationObject));

      var writeStream = new System.IO.StringWriter();

      var testObject = new TestNotificationObject();

      serializer.Serialize(writeStream, testObject);


      var readStream = new System.IO.StringReader(writeStream.ToString());
      var reconstitutedObject = serializer.Deserialize(readStream) as TestNotificationObject;

      Assert.IsNotNull(reconstitutedObject);
    }
Пример #6
0
        public void NotificationShouldBeXmlSerializable()
        {
            var serializer = new XmlSerializer(typeof(TestNotificationObject));

            var writeStream = new System.IO.StringWriter();

            var testObject = new TestNotificationObject();

            serializer.Serialize(writeStream, testObject);


            var readStream          = new System.IO.StringReader(writeStream.ToString());
            var reconstitutedObject = serializer.Deserialize(readStream) as TestNotificationObject;

            Assert.IsNotNull(reconstitutedObject);
        }
        public void NotificationObjectShouldBeSerializable()
        {
            var serializer = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
            var stream = new System.IO.MemoryStream();
            bool invoked = false;

            var testObject = new TestNotificationObject();
            testObject.PropertyChanged += (o, e) => { invoked = true; };

            serializer.Serialize(stream, testObject);

            stream.Seek(0, System.IO.SeekOrigin.Begin);

            var reconstitutedObject = serializer.Deserialize(stream) as TestNotificationObject;

            Assert.IsNotNull(reconstitutedObject);
        }
    public void NotificationShouldBeDataContractSerializable()
    {
      var serializer = new DataContractSerializer(typeof(TestNotificationObject));
      var stream = new System.IO.MemoryStream();
      bool invoked = false;

      var testObject = new TestNotificationObject();
      testObject.PropertyChanged += (o, e) => { invoked = true; };

      serializer.WriteObject(stream, testObject);

      stream.Seek(0, System.IO.SeekOrigin.Begin);

      var reconstitutedObject = serializer.ReadObject(stream) as TestNotificationObject;

      Assert.IsNotNull(reconstitutedObject);
    }
Пример #9
0
        public void NotificationObjectShouldBeSerializable()
        {
            var  serializer = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
            var  stream     = new System.IO.MemoryStream();
            bool invoked    = false;

            var testObject = new TestNotificationObject();

            testObject.PropertyChanged += (o, e) => { invoked = true; };

            serializer.Serialize(stream, testObject);

            stream.Seek(0, System.IO.SeekOrigin.Begin);

            var reconstitutedObject = serializer.Deserialize(stream) as TestNotificationObject;

            Assert.IsNotNull(reconstitutedObject);
        }
Пример #10
0
        public void NotificationShouldBeDataContractSerializable()
        {
            var  serializer = new DataContractSerializer(typeof(TestNotificationObject));
            var  stream     = new System.IO.MemoryStream();
            bool invoked    = false;

            var testObject = new TestNotificationObject();

            testObject.PropertyChanged += (o, e) => { invoked = true; };

            serializer.WriteObject(stream, testObject);

            stream.Seek(0, System.IO.SeekOrigin.Begin);

            var reconstitutedObject = serializer.ReadObject(stream) as TestNotificationObject;

            Assert.IsNotNull(reconstitutedObject);
        }