public void TestExceptionSerialization()
        {
            ShardLocation sl1 = new ShardLocation("dataSource1", "database1");
            ShardLocation sl2 = new ShardLocation("dataSource2", "database2");

            MultiShardException innerEx1 = new MultiShardException(sl1);
            MultiShardException innerEx2 = new MultiShardException(sl2);

            List <Exception> exList = new List <Exception>();

            exList.Add(innerEx1);
            exList.Add(innerEx2);

            MultiShardAggregateException aggEx = new MultiShardAggregateException(exList);

            MultiShardException deserialized1 = CommonTestUtils.SerializeDeserialize(innerEx1);

            CompareForEquality(innerEx1, deserialized1);

            MultiShardException deserialized2 = CommonTestUtils.SerializeDeserialize(innerEx2);

            CompareForEquality(innerEx2, deserialized2);

            MultiShardAggregateException deserialized3 = CommonTestUtils.SerializeDeserialize(aggEx);

            CompareForEquality(aggEx, deserialized3);
        }
        public void TestSchemaInfoExceptionSerializability()
        {
            SchemaInfoException ex           = new SchemaInfoException(SchemaInfoErrorCode.SchemaInfoNameConflict, "message");
            SchemaInfoException deserialized = CommonTestUtils.SerializeDeserialize(ex);

            // Validate
            Assert.AreEqual(ex.ErrorCode, deserialized.ErrorCode, "ErrorCode");
            Assert.AreEqual(ex.ToString(), deserialized.ToString(), "ToString()");
        }
Esempio n. 3
0
        public void TestShardMapManagerExceptionSerializability()
        {
            var errorCategory = ShardManagementErrorCategory.RangeShardMap;
            var errorCode     = ShardManagementErrorCode.ShardMapDoesNotExist;

            ShardManagementException ex           = new ShardManagementException(errorCategory, errorCode, "Testing");
            ShardManagementException deserialized = CommonTestUtils.SerializeDeserialize(ex);

            // Validate
            Assert.AreEqual(ex.ErrorCode, deserialized.ErrorCode, "ErrorCode");
            Assert.AreEqual(ex.ErrorCategory, deserialized.ErrorCategory, "ErrorCategory");
            Assert.AreEqual(ex.ToString(), deserialized.ToString(), "ToString()");
        }