Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

AbstractDependencyInjectionSpringContextTests Class

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 .


[Visual Basic]
Public MustInherit Class AbstractDependencyInjectionSpringContextTests
    Inherits AbstractSpringContextTests
public abstract class AbstractDependencyInjectionSpringContextTests : AbstractSpringContextTests

Thread Safety

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

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

property, most likely to return the test class. In conjunction with this you would probably override the
method, 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.


Namespace: Spring.Testing.Microsoft

Assembly: Spring.Testing.Microsoft (in Spring.Testing.Microsoft.dll)

See Also

AbstractDependencyInjectionSpringContextTests Members | Spring.Testing.Microsoft Namespace