- source.zip
- MetaContainer
- Libs
- Autofac.dll
- Castle.Core.dll
- Castle.DynamicProxy2.dll
- Castle.MicroKernel.dll
- Castle.Windsor.dll
- Microsoft.Practices.ObjectBuilder2.dll
- Microsoft.Practices.ServiceLocation.dll
- Microsoft.Practices.Unity.dll
- nunit.framework.dll
- Rhino.Mocks.dll
- MetaContainer.Autofac
- MetaContainer.Castle
- MetaContainer.sln
- MetaContainer.Unity
- MetaContainer.vssscc
- MetaContainer
- Samples.MetaContainer.MoneyExchangeSample.ConsoleHost
- Samples.MetaContainer.MoneyExchangeSample.ContainerAbstraction
- Samples.MetaContainer.MoneyExchangeSample.DomainModel
- Tests.MetaContainer.Autofac
- Tests.MetaContainer.Castle
- Tests.MetaContainer.Unity
- Tests.MetaContainer
|
using MetaContainer;
using NUnit.Framework;
using Rhino.Mocks;
namespace Tests.MetaContainer
{
[TestFixture]
public class ExtensionMethodsTest
{
private MockRepository _mocks;
[SetUp]
public void SetUp()
{
_mocks = new MockRepository();
}
[Test]
public void RegisterWithoutName()
{
IMetaContainer container = _mocks.CreateMock<IMetaContainer>();
using (_mocks.Record())
{
container.Register(typeof(ITestInterface), typeof(SampleTestImpl), null);
}
using (_mocks.Playback())
{
container.Register(typeof(ITestInterface), typeof(SampleTestImpl));
}
}
[Test]
public void RegisterGenericWithName()
{
IMetaContainer container = _mocks.CreateMock<IMetaContainer>();
using (_mocks.Record())
{
container.Register(typeof(ITestInterface), typeof(SampleTestImpl), null);
}
using (_mocks.Playback())
{
container.Register(typeof(ITestInterface), typeof(SampleTestImpl));
}
}
[Test]
public void GenericFactoryMethodRegistrationIsForwardedToNonGenericOne()
{
IMetaContainer container = _mocks.CreateMock<IMetaContainer>();
using (_mocks.Record())
{
container.Register(typeof(ITestInterface), name => new SampleTestImpl(), "name", Scope.Transient);
LastCall.IgnoreArguments();
container.Register(typeof(ITestInterface), name => new SampleTestImpl(), null, Scope.Transient);
LastCall.IgnoreArguments();
}
using (_mocks.Playback())
{
container.Register<ITestInterface>(name => new SampleTestImpl(), "name");
container.Register<ITestInterface>(name => new SampleTestImpl());
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.