예제 #1
0
        public void InvalidCsvExceptionTest1()
        {
            var e = new InvalidCsvException();

            Assert.IsNotNull(e);
            Assert.IsNotNull(e.Message);
        }
예제 #2
0
        public void InvalidCsvExceptionTest2()
        {
            string message = "Message";

            var e = new InvalidCsvException(message);

            Assert.IsNotNull(e);
            Assert.AreEqual(message, e.Message);
        }
예제 #3
0
        public void InvalidCsvExceptionTest3()
        {
            string message = "Message";

            var inner = new Exception();

            var e = new InvalidCsvException(message, inner);

            Assert.IsNotNull(e);
            Assert.AreSame(inner, e.InnerException);
            Assert.AreEqual(message, e.Message);
        }
예제 #4
0
        public void ToStringTest()
        {
            string message = "Message";

            int lineNumber = 4711;
            int charIndex  = 42;

            var e = new InvalidCsvException(message, lineNumber, charIndex);

            string s = e.ToString();


            Assert.IsNotNull(s);

            TestContext.WriteLine(s);
        }
예제 #5
0
        public void InvalidCsvExceptionTest4()
        {
            string message = "Message";

            int lineNumber = 4711;
            int charIndex  = 42;


            var e = new InvalidCsvException(message, lineNumber, charIndex);

            Assert.IsNotNull(e);

            Assert.AreEqual(message, e.Message);
            Assert.AreEqual(lineNumber, e.CsvLineNumber);
            Assert.AreEqual(charIndex, e.CsvCharIndex);
        }
예제 #6
0
        public void GetObjectDataTest()
        {
            string message = "Message";

            int lineNumber = 4711;
            int charIndex  = 42;

            var e = new InvalidCsvException(message, lineNumber, charIndex);


            using var memStream = new MemoryStream();
            var bf = new BinaryFormatter();

            bf.Serialize(memStream, e);

            memStream.Position = 0;

            var e2 = (InvalidCsvException)bf.Deserialize(memStream);

            Assert.AreEqual(e.Message, e2.Message);
            Assert.AreEqual(e.CsvLineNumber, e2.CsvLineNumber);
            Assert.AreEqual(e.CsvCharIndex, e2.CsvCharIndex);
        }