Example #1
0
        public void ResolveEnumerableOutsideOfVolatileScope()
        {
            var implicitContext = Create <IImplicitContext>();
            var volatileContext = new VolatileContext(implicitContext.Object);

            implicitContext.SetupGet(o => o.Container).Returns((IVolatileContainer)null);

            Assert.Throws <VolatileResolutionException>(() => volatileContext.ResolveEnumerable <IVolatileObject>());
        }
Example #2
0
        public void ResolveEnumerable()
        {
            var implicitContext = Create <IImplicitContext>();
            var volatileContext = new VolatileContext(implicitContext.Object);
            var container       = Create <IVolatileContainer>();
            var volatileObject  = Create <List <IVolatileObject> >().Object;

            container.Setup(o => o.ResolveEnumerable <IVolatileObject>()).Returns(volatileObject);
            implicitContext.SetupGet(o => o.Container).Returns(container.Object);

            Assert.AreEqual(volatileObject, volatileContext.ResolveEnumerable <IVolatileObject>());
        }