Convenient superclass for tests depending on a Spring context. The test instance itself is populated by Dependency Injection.
For a list of all members of this type, see AbstractDependencyInjectionSpringContextTests Members .
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
Really for integration testing, not unit testing. You should not normally use the Spring container for unit tests: simply populate your objects in plain NUnit tests!
This supports two modes of populating the test:
This class will normally cache contexts based on a context key: normally the config locations String array describing the Spring resource descriptors making up the context. Unless the
SetDirty()method is called by a test, the context will not be reloaded, even across different subclasses of this test. This is particularly beneficial if your context is slow to construct, for example if you are using Hibernate and the time taken to load the mappings is an issue.
If you don't want this behavior, you can override the
ContextKeyproperty, most likely to return the test class. In conjunction with this you would probably override the
GetContextmethod, which by default loads the locations specified by the
WARNING: When doing integration tests from within VS.NET, only use assembly resource URLs. Else, you may see misleading failures when changing context locations.
Assembly: Spring.Testing.Microsoft (in Spring.Testing.Microsoft.dll)