public void SerializesWithNoState() { ObjectDefinitionStoreException inex = new ObjectDefinitionStoreException(); CheckSerialization(inex, string.Empty, string.Empty); }
public void SerializesAllState() { string expectedName = "bing"; string expectedResourceDescription = "foo.txt"; ObjectDefinitionStoreException inex = new ObjectDefinitionStoreException( expectedResourceDescription, expectedName, "mmm..."); CheckSerialization(inex, expectedName, expectedResourceDescription); }
public void SerializesWithJustExceptionMessage() { string expectedName = string.Empty; string expectedResourceDescription = string.Empty; string expectedMessage = "Woppadoosa"; ObjectDefinitionStoreException inex = new ObjectDefinitionStoreException(expectedMessage); CheckSerialization(inex, expectedName, expectedResourceDescription); }
public void FromNullResource() { string expectedName = "bing"; string expectedResourceDescription = string.Empty; ObjectDefinitionStoreException inex = new ObjectDefinitionStoreException( (IResource)null, expectedName, "mmm..."); CheckSerialization(inex, expectedName, expectedResourceDescription); }
private static void CheckSerialization( ObjectDefinitionStoreException inex, string expectedName, string expectedResourceDescription) { ObjectDefinitionStoreException outex = (ObjectDefinitionStoreException) SerializationTestUtils.SerializeAndDeserialize(inex); Assert.AreEqual(expectedName, outex.ObjectName, "The 'ObjectName' property was not serialized / deserialized correctly."); Assert.AreEqual(expectedResourceDescription, outex.ResourceDescription, "The 'ResourceDescription' property was not serialized / deserialized correctly."); }
public void FromResource() { string expectedName = "bing"; string expectedResourceDescription = "mock.resource"; IResource resource = mocks.StrictMock <IResource>(); Expect.Call(resource.Description).Return(expectedResourceDescription); mocks.ReplayAll(); ObjectDefinitionStoreException inex = new ObjectDefinitionStoreException(resource, expectedName, "mmm..."); mocks.VerifyAll(); CheckSerialization(inex, expectedName, expectedResourceDescription); }