PersistenceSpecification for IDs fails when CheckReference is on same table is used before tables own test with identity used for ID field.

Original Post mghawksworth's Avatar

mghawksworth

30 Mar, 2010 08:37 AM via web

Sorry if this seems a bit naive, but I'm just crawling my way into unit testing and fluent!

The example!

Two tables, 'Address' and 'Regions'. The test for Address runs first using a CheckReference for a region (creating record 1 in the Regions table) then when the Regions test runs it fails as the system returns the record for the Address Test not the Regions Test.

I am following the example roughly and using...

new PersistenceSpecification<Region>(session, new CustomEqualityComparer()).
                                     CheckProperty(c => c.RegionID, ATestID).
                                     VerifyTheMappings();

Yes I know I could use the deus ex machina approach of testing for record 2 but then I need to know the run order etc.

Is there a better way of doing this, do I need a way that it tests for the ID correctly (know the run order or something better) or is having the ID in the test pointless?

Cheers
Michael

    Reply to this discussion

    Preview Comments are parsed with Markdown. Help with syntax

    Attached Files

      You can attach files up to 10MB

      How many minutes are in an hour?

      Recent Discussions

      05 Jul, 2010 10:29 PM
      05 Jul, 2010 12:45 PM
      05 Jul, 2010 12:42 PM
      05 Jul, 2010 12:17 PM
      05 Jul, 2010 12:12 PM

       

      03 Jul, 2010 12:26 AM
      02 Jul, 2010 02:17 PM
      02 Jul, 2010 08:18 AM
      02 Jul, 2010 12:20 AM
      01 Jul, 2010 10:14 PM