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)); }
public void shouldReturnDifferentContainers() { ServiceLocator.SetContainerProvider(() => new SimpleContainer()); SimpleContainer containerFromLocator = ServiceLocator.Current.GetInstance <SimpleContainer>(); SimpleContainer containerFromLocator2 = ServiceLocator.Current.GetInstance <SimpleContainer>(); Assert.IsTrue(!containerFromLocator.Equals(containerFromLocator2)); }