예제 #1
0
        public void SerializesWithNoState()
        {
            ObjectDefinitionStoreException inex
                = new ObjectDefinitionStoreException();

            CheckSerialization(inex, string.Empty, string.Empty);
        }
예제 #2
0
        public void SerializesAllState()
        {
            string expectedName = "bing";
            string expectedResourceDescription = "foo.txt";
            ObjectDefinitionStoreException inex
                = new ObjectDefinitionStoreException(
                      expectedResourceDescription, expectedName, "mmm...");

            CheckSerialization(inex, expectedName,
                               expectedResourceDescription);
        }
예제 #3
0
        public void SerializesWithJustExceptionMessage()
        {
            string expectedName = string.Empty;
            string expectedResourceDescription = string.Empty;
            string expectedMessage             = "Woppadoosa";
            ObjectDefinitionStoreException inex
                = new ObjectDefinitionStoreException(expectedMessage);

            CheckSerialization(inex, expectedName,
                               expectedResourceDescription);
        }
예제 #4
0
        public void FromNullResource()
        {
            string expectedName = "bing";
            string expectedResourceDescription = string.Empty;
            ObjectDefinitionStoreException inex
                = new ObjectDefinitionStoreException(
                      (IResource)null, expectedName, "mmm...");

            CheckSerialization(inex, expectedName,
                               expectedResourceDescription);
        }
예제 #5
0
        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.");
        }
예제 #6
0
        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);
        }