using System;
using Microsoft.Practices.Unity.Configuration.Tests.ConfigFiles;
using Microsoft.Practices.Unity.Configuration.Tests.TestObjects;
using Microsoft.Practices.Unity.TestSupport.Configuration;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Unity;
using Unity.Injection;
namespace Microsoft.Practices.Unity.Configuration.Tests
{
///
/// Summary description for When_ConfiguringContainerToResolveGenerics
///
[TestClass]
public class When_ConfiguringContainerToResolveGenerics : ContainerConfiguringFixture
{
public When_ConfiguringContainerToResolveGenerics()
: base("InjectingGenerics", String.Empty)
{
}
[TestMethod]
public void Then_GenericParameterAsStringIsProperlySubstituted()
{
Container.RegisterType(typeof(GenericObjectWithConstructorDependency<>), "manual",
new InjectionConstructor(new GenericParameter("T")));
var manualResult = Container.Resolve>("manual");
var resultForString = Container.Resolve>("basic");
Assert.AreEqual(Container.Resolve(), resultForString.Value);
}
[TestMethod]
public void Then_GenericParameterAsIntIsProperlySubstituted()
{
var resultForInt = Container.Resolve>("basic");
Assert.AreEqual(Container.Resolve(), resultForInt.Value);
}
}
}