예제 #1
0
        public void Test_CanCreateFromException()
        {
            QueuedTaskError errBase = new QueuedTaskError(new Exception("Sample exception message"));

            Assert.AreEqual("System.Exception", errBase.Type);
            Assert.AreEqual("Sample exception message", errBase.Message);
            Assert.IsNull(errBase.StackTrace);

            QueuedTaskError errInvOp = new QueuedTaskError(new InvalidOperationException("Sample invalid operation exception message"));

            Assert.AreEqual("System.InvalidOperationException", errInvOp.Type);
            Assert.AreEqual("Sample invalid operation exception message", errInvOp.Message);
            Assert.IsNull(errInvOp.StackTrace);

            QueuedTaskError errAppThrown;

            try
            {
                throw new ApplicationException("Sample application exception message");
            }
            catch (Exception exc)
            {
                errAppThrown = new QueuedTaskError(exc);
            }

            Assert.AreEqual("System.ApplicationException", errAppThrown.Type);
            Assert.AreEqual("Sample application exception message", errAppThrown.Message);
            Assert.NotNull(errAppThrown.StackTrace);
        }
예제 #2
0
        public void Test_CanCompare_AreNotEqual()
        {
            Faker faker =
                new Faker();

            QueuedTaskError err1 = new QueuedTaskError(faker.Random.AlphaNumeric(10),
                                                       faker.Lorem.Sentence(),
                                                       faker.Random.String());

            QueuedTaskError err2 = new QueuedTaskError(faker.Random.AlphaNumeric(10),
                                                       faker.Lorem.Sentence(),
                                                       faker.Random.String());

            Assert.AreNotEqual(err1, err2);
        }
예제 #3
0
 public void NotifyTaskErrored(QueuedTaskError error, bool isRecoverable)
 {
     mResult = TaskExecutionResultInfo.ExecutedWithError(error, isRecoverable);
 }