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

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

            CheckSerialization(inex, expectedName,
                               expectedResourceDescription);
        }
Exemple #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);
        }
Exemple #4
0
        public void FromNullResource()
        {
            string expectedName = "bing";
            string expectedResourceDescription = string.Empty;
            ObjectDefinitionStoreException inex
                = new ObjectDefinitionStoreException(
                      (IResource)null, expectedName, "mmm...");

            CheckSerialization(inex, expectedName,
                               expectedResourceDescription);
        }
Exemple #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.");
        }
Exemple #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);
        }