예제 #1
0
        public void SetUp()
        {
            Mock <IVocabularyController> vocabularyController = MockHelper.CreateMockVocabularyController();

            MockComponentProvider.CreateDataProvider().Setup(c => c.GetProviderPath()).Returns(String.Empty);
            //Register MockCachingProvider
            mockCache = MockComponentProvider.CreateNew <CachingProvider>();
        }
        protected CreateVocabularyPresenter CreatePresenter(Mock <ICreateVocabularyView> mockView, Mock <HttpResponseBase> mockHttpResponse)
        {
            var mockHttpContext = new Mock <HttpContextBase>();

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

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

            return(presenter);
        }
예제 #3
0
        public void SetUp()
        {
            var serviceCollection = new ServiceCollection();

            serviceCollection.AddTransient <INavigationManager>(container => Mock.Of <INavigationManager>());
            serviceCollection.AddTransient <IApplicationStatusInfo>(container => new DotNetNuke.Application.ApplicationStatusInfo(Mock.Of <IApplicationInfo>()));
            serviceCollection.AddTransient <IHostSettingsService, HostController>();
            Globals.DependencyProvider = serviceCollection.BuildServiceProvider();

            Mock <IVocabularyController> vocabularyController = MockHelper.CreateMockVocabularyController();

            MockComponentProvider.CreateDataProvider().Setup(c => c.GetProviderPath()).Returns(string.Empty);

            // Register MockCachingProvider
            this.mockCache = MockComponentProvider.CreateNew <CachingProvider>();
        }
예제 #4
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);
        }