示例#1
0
        public void ContainerResolvesIngredientThroughExtensionMethod()
        {
            var context = new XmlApplicationContext("sauce.xml");
            IIngredient ingredient = context.Resolve<IIngredient>();

            Assert.IsAssignableFrom<SauceBéarnaise>(ingredient);
        }
示例#2
0
        public void ContainerResolvesSauceBéarnaiseThroughExtensionMethod()
        {
            var context = new XmlApplicationContext("sauce.xml");
            SauceBéarnaise sauce = context.Resolve<SauceBéarnaise>();

            Assert.NotNull(sauce);
        }
示例#3
0
        public void InterceptTwoTargetsWithTheSameInterceptor()
        {
            var context = new XmlApplicationContext("InterceptTwoTargetsWithTheSameInterceptor.xml");

            context.Resolve<IFoo>().DoFoo();
            context.Resolve<IBar>().DoBar();

            var spy = context.Resolve<SpyInterceptor>();
            Assert.True(spy.Invocations.Select(i => i.Method.Name).Contains("DoFoo"));
            Assert.True(spy.Invocations.Select(i => i.Method.Name).Contains("DoBar"));
        }