public void WhenNotifyingOnAnInstanceProperty_ThenAnEventIsFired() { var testObject = new TestNotificationObject(); var changeTracker = new PropertyChangeTracker(testObject); testObject.InstanceProperty = "newValue"; Assert.IsTrue(changeTracker.ChangedProperties.Contains("InstanceProperty")); }
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); }
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); }