public void Serialization() { var innerException = new Exception("Test"); var exception = new ObjectsNotFoundException("Message", new[] { DomainObjectIDs.Order1, DomainObjectIDs.Order3 }, innerException); var deserializedInstance = Serializer.SerializeAndDeserialize(exception); Assert.That(deserializedInstance.Message, Is.EqualTo("Message")); Assert.That(deserializedInstance.IDs, Is.EqualTo(new[] { DomainObjectIDs.Order1, DomainObjectIDs.Order3 })); Assert.That(deserializedInstance.InnerException, Is.Not.Null); }
public void IsPropertyAccessible_WithObjectsNotFoundException_ReturnsTrue() { var instance = SampleBindableDomainObject.NewObject(); var property = GetProperty(instance); var strategy = (IBindablePropertyReadAccessStrategy) new BindableDomainObjectPropertyReadAccessStrategy(); var originalException = new ObjectsNotFoundException("The Message", new ObjectID[0], null); 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 ObjectsNotFoundException occured while getting the value of property 'Name' for business object with ID '" + instance.ID + "'.")); Assert.That(actualException.InnerException, Is.SameAs(originalException)); }