Hi,

I'm unit testing my project and am getting the following error when I
run more than 1 unit test fixture at the same time: "You can't invoke
ActiveRecordStarter.Initialize more than once"

My project structure is:

Tests Directory
|- AbstractModelTestCase (from:
http://www.castleproject.org/activerecord/documentation/v1rc1/usersguide/unittesting.html)
|- TestFixture1.cs (extends AbstractModelTestCase)
|- TestFixture2.cs (extends AbstractModelTestCase)

Could this be related to the setup/tear down instantiation in the
InitFramework() code that I picked up? I made the following amendments
to it but there is no reason why this would have an effect as it's all
standard stuff:

protected virtual void InitFramework()
    {
        XmlConfigurationSource source = new XmlConfigurationSource
(@"Tests/appconfig.xml");
        ActiveRecordStarter.Initialize(source,
MyCompany.Common.Utils.SchemaUtils.AllActiveRecordObjects.ToArray
()); //generates an array of all AR objects
    }

The unit tests run correctly if I run NUnit against TestFixture1.cs on
its own, or if I run it against TestFixture2.cs on its own, but NOT if
I run it against the TestsDirectory (i.e. TestFixture1 and
TestFixture2 together) - I get the "You can't invoke
ActiveRecordStarter.Initialize more than once" error. This also
happens if I change the ActiveRecordStarter.Initialize(source,
MyCompany.Common.Utils.SchemaUtils.AllActiveRecordObjects.ToArray());
line to instantiate wach object on it's own (like in the example
code).

What am I doing wrong? Thanks..

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to