예제 #1
0
        public void shouldReturnTheSameContainer()
        {
            SimpleContainer simpleContainer = new SimpleContainer();

            ServiceLocator.SetContainerProvider(() => simpleContainer);
            SimpleContainer containerFromLocator  = ServiceLocator.Current.GetInstance <SimpleContainer>();
            SimpleContainer containerFromLocator2 = ServiceLocator.Current.GetInstance <SimpleContainer>();

            Assert.IsTrue(containerFromLocator.Equals(simpleContainer));
            Assert.IsTrue(containerFromLocator.Equals(containerFromLocator2));
        }
예제 #2
0
        public void shouldReturnDifferentContainers()
        {
            ServiceLocator.SetContainerProvider(() => new SimpleContainer());
            SimpleContainer containerFromLocator  = ServiceLocator.Current.GetInstance <SimpleContainer>();
            SimpleContainer containerFromLocator2 = ServiceLocator.Current.GetInstance <SimpleContainer>();

            Assert.IsTrue(!containerFromLocator.Equals(containerFromLocator2));
        }