Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void runAllMustRunAllAndPropagateMultipleErrors()
        internal virtual void RunAllMustRunAllAndPropagateMultipleErrors()
        {
            // given
            Task        task1             = new Task(this);
            Task        task2             = new Task(this);
            Task        task3             = new Task(this);
            Exception   expectedError     = new Exception("Killroy was here");
            ThreadStart throwingTask1     = Error(expectedError);
            Exception   expectedException = new Exception("and here");
            ThreadStart throwingTask2     = RuntimeException(expectedException);

            IList <ThreadStart> runnables = Arrays.asList(task1, task2, task3, throwingTask1, throwingTask2);

            Collections.shuffle(runnables);

            // when
            string    failureMessage = "Something wrong, Killroy must be here somewhere.";
            Exception actual         = assertThrows(typeof(Exception), () => Runnables.runAll(failureMessage, runnables.ToArray()));

            // then
            AssertRun(task1, task2, task3);
            assertTrue(Exceptions.findCauseOrSuppressed(actual, t => t == expectedError).Present);
            assertTrue(Exceptions.findCauseOrSuppressed(actual, t => t == expectedException).Present);
            assertEquals(failureMessage, actual.Message);
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void runAllMustRunAll()
        internal virtual void RunAllMustRunAll()
        {
            // given
            Task task1 = new Task(this);
            Task task2 = new Task(this);
            Task task3 = new Task(this);

            // when
            Runnables.RunAll("", task1, task2, task3);

            // then
            AssertRun(task1, task2, task3);
        }