Comment 8 for bug 1071164

Revision history for this message
Simone Busoli (simone.busoli) wrote : Re: [Bug 1071164] Re: Support async methods in usage scenarios of Throws constraints

So I'm planning to do the same for this feature. The common code will
basically provide an operation to invoke a piece of code, and will wrap the
code to perform the asynchronous invocation, if needed.

Simone

On Fri, Oct 26, 2012 at 11:11 PM, Charlie Poole <email address hidden> wrote:

> Hi Simone,
>
> Yes, that's what we already do with at least one source file,
> ITestCaseData.cs.
> In NUnitLite and NUnit 3.0, the duplication can be eliminated.
>
> Charlie
>
> On Fri, Oct 26, 2012 at 1:49 PM, Simone Busoli
> <email address hidden> wrote:
> > Hi Charlie,
> >
> > I'm working on this and I have one question. We basically need to do
> > with Assert.Throws(async () => [some async code]) the same we're doing
> > while executing tests, awaiting it. The code for the latter is in core,
> > are there any existing ways by which we share code between the two?
> > Since they obviously don't share any assembly references and it's only
> > core which interacts with framework via reflection, the only thing which
> > comes to mind is to just let the code leave in core and "reference" it
> > from framework via "Add as link" feature in VS, which allows to use the
> > same source file form both projects.
> >
> > Thoughts?
> >
> > --
> > You received this bug notification because you are subscribed to NUnit
> > Extended Testing Platform.
> > https://bugs.launchpad.net/bugs/1071164
> >
> > Title:
> > Support async methods in usage scenarios of Throws constraints
> >
> > To manage notifications about this bug go to:
> > https://bugs.launchpad.net/nunit-3.0/+bug/1071164/+subscriptions
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1071164
>
> Title:
> Support async methods in usage scenarios of Throws constraints
>
> Status in NUnit Test Framework:
> Triaged
> Status in NUnitLite Testing Framework:
> Triaged
> Status in NUnit V2 Test Framework:
> In Progress
>
> Bug description:
> Although we support async test methods, we're not handling other async
> things properly. For instance this is not working as expected:
>
> Assert.That(async () => await DoSomething(), Throws.Exception);
>
> The reasons is the same as why we didn't support async methods: we are
> not waiting until the function has completed its execution.
>
> Additional details here: http://stackoverflow.com/questions/13056716
> /async-unit-tests-not-working-as-expected
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunit-3.0/+bug/1071164/+subscriptions
>