public void op_DoGetInstance_Type_stringNull() { var expected = new Mock <ITest>().Object; var container = new Mock <IUnityContainer>(); container .Setup(x => x.Resolve(typeof(ITest), null)) .Returns(expected) .Verifiable(); var obj = new UnityServiceLocator(container.Object); var actual = obj.GetInstance <ITest>(); Assert.Same(expected, actual); container.VerifyAll(); }
public void op_DoGetAllInstances_Type() { var expected = new Mock <ITest>().Object; var container = new Mock <IUnityContainer>(); container .Setup(x => x.ResolveAll(typeof(ITest))) .Returns(new[] { expected }) .Verifiable(); var obj = new UnityServiceLocator(container.Object); var actual = obj.GetAllInstances <ITest>().First(); Assert.Same(expected, actual); container.VerifyAll(); }