Ejemplo n.º 1
0
        public void ResolveMocksByName_ImplicitMocksCreated()
        {
            var container = new UnityContainer();

            container.EnableMocking();

            var fatal = container.Resolve <ILogger>("fatal");
            var trace = container.Resolve <ILogger>("trace");

            Assert.AreNotSame(fatal, trace);
        }
Ejemplo n.º 2
0
        public void ResolveMocksWithoutRegistration_ImplicitMocksCreated()
        {
            var container = new UnityContainer();

            container.EnableMocking();
            var greeter = container.RegisterType <Greeter>().Resolve <Greeter>();

            greeter.Greet();

            var logger = container.Resolve <ILogger>();

            Mock.Assert(() => logger.Log("0: "), Occurs.Once());
        }
Ejemplo n.º 3
0
 public void SetUp()
 {
     Container = new UnityContainer();
     Container.EnableMocking();
     DependencyInjection.Container = Container;
 }