public void ResolveOutsideOfVolatileScope() { var implicitContext = Create <IImplicitContext>(); var volatileContext = new VolatileContext(implicitContext.Object); implicitContext.SetupGet(o => o.Container).Returns((IVolatileContainer)null); Assert.Throws <VolatileResolutionException>(() => volatileContext.Resolve <IVolatileObject>()); }
public void Resolve() { var implicitContext = Create <IImplicitContext>(); var volatileContext = new VolatileContext(implicitContext.Object); var container = Create <IVolatileContainer>(); var volatileObject = Create <IVolatileObject>().Object; container.Setup(o => o.Resolve <IVolatileObject>()).Returns(volatileObject); implicitContext.SetupGet(o => o.Container).Returns(container.Object); Assert.AreEqual(volatileObject, volatileContext.Resolve <IVolatileObject>()); }