public void Serialization() { ObjectDeletedException exception = new ObjectDeletedException(DomainObjectIDs.Order1); using (MemoryStream memoryStream = new MemoryStream()) { BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(memoryStream, exception); memoryStream.Seek(0, SeekOrigin.Begin); formatter = new BinaryFormatter(); exception = (ObjectDeletedException)formatter.Deserialize(memoryStream); Assert.That(exception.ID, Is.EqualTo(DomainObjectIDs.Order1)); } }
public void IsPropertyAccessible_WithObjectDeletedException_ReturnsTrue() { var instance = SampleBindableDomainObject.NewObject(); var property = GetProperty(instance); var strategy = (IBindablePropertyReadAccessStrategy) new BindableDomainObjectPropertyReadAccessStrategy(); var originalException = new ObjectDeletedException("The Message"); BusinessObjectPropertyAccessException actualException; var result = strategy.IsPropertyAccessException(instance, property, originalException, out actualException); Assert.That(result, Is.True); Assert.That(actualException, Is.Not.Null); Assert.That( actualException.Message, Is.EqualTo( "An ObjectDeletedException occured while getting the value of property 'Name' for business object with ID '" + instance.ID + "'.")); Assert.That(actualException.InnerException, Is.SameAs(originalException)); }
/// <summary> /// Initializes a new instance of the <see cref="HibernateObjectRetrievalFailureException"/> class. /// </summary> /// <param name="ex">The ex.</param> public HibernateObjectRetrievalFailureException(ObjectDeletedException ex) : base(ex.PersistentClass, ex.Identifier, ex.Message, ex) { }