Esempio n. 1
0
        public void SerializesWithNoState()
        {
            ObjectDefinitionStoreException inex
                = new ObjectDefinitionStoreException();

            CheckSerialization(inex, string.Empty, string.Empty);
        }
		public void FromNullResource()
		{
			string expectedName = "bing";
			string expectedResourceDescription = string.Empty;
			ObjectDefinitionStoreException inex
				= new ObjectDefinitionStoreException(
				(IResource) null, expectedName, "mmm...");
			CheckSerialization(inex, expectedName,
				expectedResourceDescription);
		}
Esempio n. 3
0
        public void SerializesAllState()
        {
            string expectedName = "bing";
            string expectedResourceDescription = "foo.txt";
            ObjectDefinitionStoreException inex
                = new ObjectDefinitionStoreException(
                      expectedResourceDescription, expectedName, "mmm...");

            CheckSerialization(inex, expectedName,
                               expectedResourceDescription);
        }
Esempio n. 4
0
        public void SerializesWithJustExceptionMessage()
        {
            string expectedName = string.Empty;
            string expectedResourceDescription = string.Empty;
            string expectedMessage             = "Woppadoosa";
            ObjectDefinitionStoreException inex
                = new ObjectDefinitionStoreException(expectedMessage);

            CheckSerialization(inex, expectedName,
                               expectedResourceDescription);
        }
Esempio n. 5
0
        public void FromNullResource()
        {
            string expectedName = "bing";
            string expectedResourceDescription = string.Empty;
            ObjectDefinitionStoreException inex
                = new ObjectDefinitionStoreException(
                      (IResource)null, expectedName, "mmm...");

            CheckSerialization(inex, expectedName,
                               expectedResourceDescription);
        }
		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);
		}
Esempio n. 7
0
        public void FromResource()
        {
            string    expectedName = "bing";
            string    expectedResourceDescription = "mock.resource";
            IResource resource = A.Fake <IResource>();

            A.CallTo(() => resource.Description).Returns(expectedResourceDescription);

            ObjectDefinitionStoreException inex = new ObjectDefinitionStoreException(resource, expectedName, "mmm...");

            CheckSerialization(inex, expectedName, expectedResourceDescription);
        }
Esempio n. 8
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.");
        }
        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);
        }
		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 SerializesWithNoState()
		{
			ObjectDefinitionStoreException inex
				= new ObjectDefinitionStoreException();
			CheckSerialization(inex, string.Empty, string.Empty);
		}
		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.");
		}