예제 #1
0
        public void SingleStringConstructorShouldSetMessageAndAdapterType()
        {
            var actual = new AdoAdapterException("Foo");

            Assert.AreEqual(typeof(AdoAdapter), actual.AdapterType);
            Assert.AreEqual("Foo", actual.Message);
        }
 public void StringAndDictionaryConstructorShouldSetCommandTextAndParametersAndAdapterType()
 {
     var param = new Dictionary<string, object> { { "P", "quux" } };
     var actual = new AdoAdapterException("Foo", param);
     Assert.AreEqual(typeof(AdoAdapter), actual.AdapterType);
     Assert.AreEqual("Foo", actual.CommandText);
     Assert.AreEqual("quux", actual.Parameters["P"]);
 }
 public void StringAndDbCommandConstructorShouldSetMessageAndCommandTextAndAdapterType()
 {
     var command = new SqlCommand("Bar");
     var actual = new AdoAdapterException("Foo", command);
     Assert.AreEqual(typeof(AdoAdapter), actual.AdapterType);
     Assert.AreEqual("Foo", actual.Message);
     Assert.AreEqual(command.CommandText, actual.CommandText);
 }
 public void StringAndExceptionConstructorShouldSetMessageAndInnerExceptionAndAdapterType()
 {
     var inner = new Exception();
     var actual = new AdoAdapterException("Foo", inner);
     Assert.AreEqual(typeof(AdoAdapter), actual.AdapterType);
     Assert.AreEqual("Foo", actual.Message);
     Assert.AreSame(inner, actual.InnerException);
 }
예제 #5
0
        public void StringAndDbCommandConstructorShouldSetMessageAndCommandTextAndAdapterType()
        {
            var command = new SqlCommand("Bar");
            var actual  = new AdoAdapterException("Foo", command);

            Assert.AreEqual(typeof(AdoAdapter), actual.AdapterType);
            Assert.AreEqual("Foo", actual.Message);
            Assert.AreEqual(command.CommandText, actual.CommandText);
        }
예제 #6
0
        public void StringAndExceptionConstructorShouldSetMessageAndInnerExceptionAndAdapterType()
        {
            var inner  = new Exception();
            var actual = new AdoAdapterException("Foo", inner);

            Assert.AreEqual(typeof(AdoAdapter), actual.AdapterType);
            Assert.AreEqual("Foo", actual.Message);
            Assert.AreSame(inner, actual.InnerException);
        }
예제 #7
0
        public void StringAndDictionaryConstructorShouldSetCommandTextAndParametersAndAdapterType()
        {
            var param = new Dictionary <string, object> {
                { "P", "quux" }
            };
            var actual = new AdoAdapterException("Foo", param);

            Assert.AreEqual(typeof(AdoAdapter), actual.AdapterType);
            Assert.AreEqual("Foo", actual.CommandText);
            Assert.AreEqual("quux", actual.Parameters["P"]);
        }
        public void SerializationTest()
        {
            var param = new Dictionary<string, object> { { "P", "quux" } };
            var source = new AdoAdapterException("Foo", param);

            var stream = new MemoryStream();
            var serializer = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
            serializer.Serialize(stream, source);

            stream.Position = 0;

            var actual = serializer.Deserialize(stream) as AdoAdapterException;

            Assert.IsNotNull(actual);
            Assert.AreEqual(typeof(AdoAdapter), actual.AdapterType);
            Assert.AreEqual("Foo", actual.CommandText);
            Assert.AreEqual("quux", actual.Parameters["P"]);
        }
예제 #9
0
        public void SerializationTest()
        {
            var param = new Dictionary <string, object> {
                { "P", "quux" }
            };
            var source = new AdoAdapterException("Foo", param);

            var stream     = new MemoryStream();
            var serializer = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

            serializer.Serialize(stream, source);

            stream.Position = 0;

            var actual = serializer.Deserialize(stream) as AdoAdapterException;

            Assert.IsNotNull(actual);
            Assert.AreEqual(typeof(AdoAdapter), actual.AdapterType);
            Assert.AreEqual("Foo", actual.CommandText);
            Assert.AreEqual("quux", actual.Parameters["P"]);
        }
예제 #10
0
        public void EmptyConstructorShouldSetAdapterType()
        {
            var actual = new AdoAdapterException();

            Assert.AreEqual(typeof(AdoAdapter), actual.AdapterType);
        }
 public void SingleStringConstructorShouldSetMessageAndAdapterType()
 {
     var actual = new AdoAdapterException("Foo");
     Assert.AreEqual(typeof(AdoAdapter), actual.AdapterType);
     Assert.AreEqual("Foo", actual.Message);
 }
 public void EmptyConstructorShouldSetAdapterType()
 {
     var actual = new AdoAdapterException();
     Assert.AreEqual(typeof(AdoAdapter), actual.AdapterType);
 }