Esempio n. 1
0
        public void SetUp()
        {
            _mockRepository = new MockRepository();

            _rootFunction = new TestFunction();
            _subFunction  = _mockRepository.PartialMock <TestFunction>();

            _httpContextMock  = _mockRepository.DynamicMock <HttpContextBase>();
            _pageExecutorMock = _mockRepository.StrictMock <IWxePageExecutor>();
            _functionState    = new WxeFunctionState(_rootFunction, true);

            _pageStep = _mockRepository.PartialMock <WxePageStep> ("ThePage");
            _pageStep.SetPageExecutor(_pageExecutorMock);

            _pageMock           = _mockRepository.DynamicMock <IWxePage>();
            _postBackCollection = new NameValueCollection {
                { "Key", "Value" }
            };
            _wxeHandler = new WxeHandler();

            UrlMappingConfiguration.Current.Mappings.Add(new UrlMappingEntry(_rootFunction.GetType(), "~/root.wxe"));
            UrlMappingConfiguration.Current.Mappings.Add(new UrlMappingEntry(_subFunction.GetType(), "~/sub.wxe"));

            _functionStateManager = new WxeFunctionStateManager(new FakeHttpSessionStateBase());
            _wxeContext           = new WxeContext(_httpContextMock, _functionStateManager, _functionState, new NameValueCollection());
        }
        public void SetUp()
        {
            _mockRepository = new MockRepository();

            _rootFunction = new TestFunction();
            _subFunction  = _mockRepository.PartialMock <TestFunction>();

            _httpContextMock  = _mockRepository.DynamicMock <HttpContextBase>();
            _pageExecutorMock = _mockRepository.StrictMock <IWxePageExecutor>();
            _functionState    = new WxeFunctionState(_rootFunction, true);

            _pageStep = _mockRepository.PartialMock <WxePageStep> ("ThePage");
            _pageStep.SetPageExecutor(_pageExecutorMock);

            _functionStateManager = new WxeFunctionStateManager(new FakeHttpSessionStateBase());
            _wxeContext           = new WxeContext(_httpContextMock, _functionStateManager, _functionState, new NameValueCollection());
        }
Esempio n. 3
0
        public void SetUp()
        {
            _mockRepository = new MockRepository();

            _rootFunction = new TestFunction();
            PrivateInvoke.InvokeNonPublicMethod(_rootFunction, "SetFunctionToken", "RootFunction");

            _subFunction = _mockRepository.PartialMock <TestFunction>();

            _httpContextMock  = _mockRepository.DynamicMock <HttpContextBase>();
            _pageExecutorMock = _mockRepository.StrictMock <IWxePageExecutor>();
            _functionState    = new WxeFunctionState(_rootFunction, true);

            _pageStep = _mockRepository.PartialMock <WxePageStep> ("ThePage");
            _pageStep.SetPageExecutor(_pageExecutorMock);
            _rootFunction.Add(_pageStep);

            _pageMock           = _mockRepository.DynamicMock <IWxePage>();
            _postBackCollection = new NameValueCollection {
                { "Key", "Value" }
            };
            _wxeHandler = new WxeHandler();

            UrlMappingConfiguration.Current.Mappings.Add(new UrlMappingEntry(_rootFunction.GetType(), "~/root.wxe"));
            UrlMappingConfiguration.Current.Mappings.Add(new UrlMappingEntry(_subFunction.GetType(), "~/sub.wxe"));

            _functionStateManager = new WxeFunctionStateManager(new FakeHttpSessionStateBase());

            Uri uri = new Uri("http://localhost/root.wxe");

            _responseMock = _mockRepository.StrictMock <HttpResponseBase>();
            _responseMock.Stub(stub => stub.ApplyAppPathModifier("~/sub.wxe")).Return("/session/sub.wxe").Repeat.Any();
            _responseMock.Stub(stub => stub.ApplyAppPathModifier("/session/sub.wxe")).Return("/session/sub.wxe").Repeat.Any();
            _responseMock.Stub(stub => stub.ApplyAppPathModifier("~/root.wxe")).Return("/session/root.wxe").Repeat.Any();
            _responseMock.Stub(stub => stub.ApplyAppPathModifier("/session/root.wxe")).Return("/session/root.wxe").Repeat.Any();
            _responseMock.Stub(stub => stub.ContentEncoding).Return(Encoding.Default).Repeat.Any();
            _httpContextMock.Stub(stub => stub.Response).Return(_responseMock).Repeat.Any();

            _requestMock = _mockRepository.StrictMock <HttpRequestBase>();
            _requestMock.Stub(stub => stub.Url).Return(uri).Repeat.Any();
            _httpContextMock.Stub(stub => stub.Request).Return(_requestMock).Repeat.Any();

            _wxeContext = new WxeContext(_httpContextMock, _functionStateManager, _functionState, new NameValueCollection());
            WxeContextMock.SetCurrent(_wxeContext);
        }