Пример #1
0
        protected EditVocabularyPresenter CreatePresenter(Mock <IEditVocabularyView> mockView, Mock <HttpResponseBase> mockHttpResponse, Mock <HttpRequestBase> mockHttpRequest, bool initialize)
        {
            MockHelper.CreateMockScopeTypeController();

            var mockHttpContext = new Mock <HttpContextBase>();

            mockHttpContext.Setup(h => h.Response).Returns(mockHttpResponse.Object);
            mockHttpContext.Setup(h => h.Request).Returns(mockHttpRequest.Object);

            var presenter = new EditVocabularyPresenter(mockView.Object, MockHelper.CreateMockVocabularyController().Object, MockHelper.CreateMockTermController().Object)
            {
                HttpContext = mockHttpContext.Object
            };

            if (initialize)
            {
                mockView.Raise(v => v.Initialize += null, EventArgs.Empty);
                mockView.Raise(v => v.Load       += null, EventArgs.Empty);
            }

            return(presenter);
        }