Try something like this:
private void RunInThread(Action action)
{
Exception pendingException = null;
Thread thread = new Thread(() =>
{
try
{
action();
}
catch (Exception ex)
{
pendingException = ex;
}
});
thread.Start();
thread.Join();
if (pendingException != null)
ExceptionUtils.RethrowExceptionWithoutStackLoss
(pendingException); // actual method name might be slightly
different. It's defined in Gallio.Common...
}
Jeff.
On Nov 9, 12:31 am, Bartosz Pierzchlewicz <[email protected]>
wrote:
> Hi,
> There is a problem when I have to make assertions in separate thread.
> This code make test passes:
>
> [Test]
> public void ThreadTest()
> {
> var thread = new Thread(ThreadMethod);
> thread.Start();
> thread.Join();
> }
>
> public void ThreadMethod()
> {
> //Assert.Fail("Fail");
> Assert.Terminate(new TestOutcome(TestStatus.Failed));
> }
>
> This only demonstrates problem.
> What I want to do is run WCF server inside test method and make
> assertions.
>
> Anyone has similar problem?
>
> Bartosz Pierzchlewicz
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MbUnit.User" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/mbunituser?hl=en
-~----------~----~----~----~------~----~------~--~---