Any way to reuse result from N Unit test in another test?
<p>I know the obvious answer here is to use [SetUp] but there is a very real chance that the code that gets the result could throw an exception and we want to test that.</p>

<p>Disclaimer up front, we are not doing "true" unit tests. What we are making could best be described as integration tests, the design is done, we did not make unit tests up front, we don't have the resources to make them now, but we are trying to get some automatic coverage on a larger chunks of functionality.</p>

<p>One such chunk is a function that aggregates data from an external database and creates 4 complex objects that have various references to each other that we then store in several tables in our internal database. We have already refactored the main aggregation function to return the objects in a wrapper class (before the aggregation function was doing the inserting as well). The caller now does the inserting, this let us write automated tests to validate the data automatically without the complexity of pulling it back out of our database.</p>

<p>The problem is that in NUnit, we want to test this Aggregation function. We can not make it any more granular. But we want to validate each of the 4 objects separately as well as verify that the function doesn't throw any exceptions.</p>

<p>The function takes quite awhile to run with even a small set so we'd like to avoid rerunning the same thing 4 different times to test each object.</p>

<p>Ideally we'd like to run a test on verifying that the function completes with no errors->feed that result into validation for one complex object->complex object-> and so on. Is this possible with NUnit or perhaps there is another paradigm we can use?</p>

<p>I suppose in the worst case, we just run the Aggregation on the same dataset 4 times.</p>