Example #1
0
        protected Context_default_dispatcher()
        {
            unitOfWorkFactory = Pleasure.MockStrict <IUnitOfWorkFactory>(unitOfWorkFactoryMock =>
            {
                unitOfWork = Pleasure.Mock <IUnitOfWork>(mock => mock.Setup(r => r.GetRepository()).Returns(Pleasure.MockAsObject <IRepository>()));
                unitOfWorkFactoryMock.Setup(r => r.Create(IsolationLevel.ReadCommitted, true, Pleasure.MockIt.IsNull <string>())).Returns(unitOfWork.Object);
                unitOfWorkFactoryMock.Setup(r => r.Create(IsolationLevel.ReadUncommitted, false, Pleasure.MockIt.IsNull <string>())).Returns(unitOfWork.Object);
            });
            IoCFactory.Instance.StubTryResolve(unitOfWorkFactory.Object);


            dispatcher = new DefaultDispatcher();
        }
        protected Context_default_dispatcher()
        {
            unitOfWorkFactory = Pleasure.MockStrict <IUnitOfWorkFactory>(unitOfWorkFactoryMock =>
            {
                unitOfWork = new Mock <IUnitOfWork>();
                unitOfWorkFactoryMock.Setup(r => r.Create(IsolationLevel.ReadCommitted, Pleasure.MockIt.IsNull <string>())).Returns(unitOfWork.Object);
                unitOfWorkFactoryMock.Setup(r => r.Create(IsolationLevel.ReadUncommitted, Pleasure.MockIt.IsNull <string>())).Returns(unitOfWork.Object);
            });
            IoCFactory.Instance.StubTryResolve(unitOfWorkFactory.Object);

            eventBroker = Pleasure.Mock <IEventBroker>();
            IoCFactory.Instance.StubTryResolve(eventBroker.Object);

            dispatcher = new DefaultDispatcher();
        }
Example #3
0
        static Context_dispatcher_controller()
        {
            dispatcher = Pleasure.Mock <IDispatcher>();

            IoCFactory.Instance.StubTryResolve(dispatcher.Object);
            controller = new FakeDispatcher();

            requestBase = Pleasure.Mock <HttpRequestBase>(mock =>
            {
                mock.SetupGet(r => r.Headers).Returns(new NameValueCollection {
                    { "X-Requested-With", "XMLHttpRequest" }
                });
            });

            responseBase = Pleasure.MockStrict <HttpResponseBase>();
            controller.ControllerContext = new ControllerContext(Pleasure.MockStrictAsObject <HttpContextBase>(mock =>
            {
                mock.SetupGet(r => r.Request).Returns(requestBase.Object);
                mock.SetupGet(r => r.Response).Returns(responseBase.Object);
            }), new RouteData(), controller);
            controller.ValueProvider = Pleasure.MockStrictAsObject <IValueProvider>(mock => mock.Setup(r => r.GetValue(Pleasure.MockIt.IsAny <string>())).Returns(new ValueProviderResult(string.Empty, string.Empty, Thread.CurrentThread.CurrentCulture)));
        }
Example #4
0
 protected static void Establish()
 {
     provider = Pleasure.MockStrict <IIoCProvider>(mock => mock.Setup(r => r.TryGet <IRepository>()).Returns(Pleasure.MockAsObject <IRepository>()));
     IoCFactory.Instance.Initialize(init => init.WithProvider(provider.Object));
     message = new FakeMessage();
 }