Пример #1
0
        public static void Exception(Exception ex, string comment = null)
        {
            EntryException e = new EntryException(ex, comment);

            AddEntry(e);

            if (ex.InnerException != null)
            {
                Exception(ex.InnerException);
            }
        }
        public void EntryExceptionConstructorMessageInnerExceptionTest()
        {
            string expectedMessage = "Exception Message";
            Exception expectedInnerException = new NotImplementedException();
            EntryException target = new EntryException(expectedMessage, expectedInnerException);
            Assert.IsNotNull(target);

            string actualMessage = target.Message;
            Assert.AreEqual(expectedMessage, actualMessage);

            Exception actualInnerException = target.InnerException;
            Assert.AreEqual(expectedInnerException, actualInnerException);
        }
 public void EntryExceptionConstructorEmptyTest()
 {
     EntryException target = new EntryException();
     Assert.IsNotNull(target);
 }
        public void EntryExceptionGetObjectDataTest()
        {
            EntryException source, target;
            source = new EntryException();

            //FUTUREDEV: Set any custom data properties and verify values after deserialization

            using (Stream formatStream = new MemoryStream()) {
                BinaryFormatter formatter = new BinaryFormatter();
                formatter.Serialize(formatStream, source);
                formatStream.Position = 0; //NOTE:  Reset stream

                target = (EntryException)formatter.Deserialize(formatStream); //NOTE:  This will cause a call to GetObjectData
            }

            Assert.IsNotNull(target);
        }
        public void EntryExceptionConstructorMessageTest()
        {
            string expected = "Exception Message";
            EntryException target = new EntryException(expected);
            Assert.IsNotNull(target);

            string actual = target.Message;
            Assert.AreEqual(expected, actual);
        }