public void DependencyOverrideOccursEverywhereTypeMatches()
        {
            // Setup
            Container
            .RegisterType <ObjectThatDependsOnSimpleObject>(Resolve.Property("OtherTestObject"))
            .RegisterType <SimpleTestObject>(Invoke.Constructor());

            // Act
            var overrideValue = new SimpleTestObject(15); // arbitrary value

            var result = Container.Resolve <ObjectThatDependsOnSimpleObject>(
                new DependencyOverride <SimpleTestObject>(overrideValue));

            // Verify
            Assert.AreSame(overrideValue, result.TestObject);
            Assert.AreSame(overrideValue, result.OtherTestObject);
        }
Example #2
0
 public ObjectThatDependsOnSimpleObject(SimpleTestObject testObject)
 {
     TestObject = testObject;
 }