Esempio n. 1
0
        public void GivenIOpenWebSource(string resourceName)
        {
            var manageWebserviceSourceControl = scenarioContext.Get <ManageWebserviceSourceControl>(Utils.ViewNameKey);
            var mockStudioUpdateManager       = new Mock <IManageWebServiceSourceModel>();

            mockStudioUpdateManager.Setup(model => model.ServerName).Returns("localhost");
            var mockEventAggregator = new Mock <IEventAggregator>();
            var mockExecutor        = new Mock <IExternalProcessExecutor>();

            var username = @"dev2\IntegrationTester";
            var password = TestEnvironmentVariables.GetVar(username);
            var webServiceSourceDefinition = new WebServiceSourceDefinition
            {
                Name         = "Test",
                HostName     = "http://RSAKLFSVRTFSBLD/IntegrationTestSite",
                DefaultQuery = "/GetCountries.ashx?extension=json&prefix=a",
                UserName     = "******",
                Password     = password
            };

            mockStudioUpdateManager.Setup(model => model.FetchSource(It.IsAny <Guid>()))
            .Returns(webServiceSourceDefinition);
            var manageWebserviceSourceViewModel = new ManageWebserviceSourceViewModel(mockStudioUpdateManager.Object, mockEventAggregator.Object, webServiceSourceDefinition, new SynchronousAsyncWorker(), mockExecutor.Object);

            manageWebserviceSourceControl.DataContext = manageWebserviceSourceViewModel;
            scenarioContext.Remove("viewModel");
            scenarioContext.Add("viewModel", manageWebserviceSourceViewModel);
        }
Esempio n. 2
0
        public void Cleanup()
        {
            var mockExecutor      = new Mock <IExternalProcessExecutor>();
            var mockUpdateManager = scenarioContext.Get <Mock <IManageWebServiceSourceModel> >("updateManager");
            var mockRequestServiceNameViewModel = scenarioContext.Get <Mock <IRequestServiceNameViewModel> >("requestServiceNameViewModel");
            var mockEventAggregator             = new Mock <IEventAggregator>();
            var task = new Task <IRequestServiceNameViewModel>(() => mockRequestServiceNameViewModel.Object);

            task.Start();
            var viewModel = new ManageWebserviceSourceViewModel(mockUpdateManager.Object, task, mockEventAggregator.Object, new SynchronousAsyncWorker(), mockExecutor.Object);
            var manageWebserviceSourceControl = scenarioContext.Get <ManageWebserviceSourceControl>(Utils.ViewNameKey);

            manageWebserviceSourceControl.DataContext = viewModel;
            FeatureContext.Current.Remove("viewModel");
            FeatureContext.Current.Add("viewModel", viewModel);
            FeatureContext.Current.Remove("externalProcessExecutor");
            FeatureContext.Current.Add("externalProcessExecutor", mockExecutor);
        }
Esempio n. 3
0
        public static void SetupForSystem()
        {
            Utils.SetupResourceDictionary();
            var manageWebserviceSourceControl = new ManageWebserviceSourceControl();
            var mockStudioUpdateManager       = new Mock <IManageWebServiceSourceModel>();

            mockStudioUpdateManager.Setup(model => model.ServerName).Returns("localhost");
            var mockRequestServiceNameViewModel = new Mock <IRequestServiceNameViewModel>();
            var mockEventAggregator             = new Mock <IEventAggregator>();
            var mockExecutor = new Mock <IExternalProcessExecutor>();
            var task         = new Task <IRequestServiceNameViewModel>(() => mockRequestServiceNameViewModel.Object);

            task.Start();
            var manageWebserviceSourceViewModel = new ManageWebserviceSourceViewModel(mockStudioUpdateManager.Object, task, mockEventAggregator.Object, new SynchronousAsyncWorker(), mockExecutor.Object);

            manageWebserviceSourceControl.DataContext = manageWebserviceSourceViewModel;
            Utils.ShowTheViewForTesting(manageWebserviceSourceControl);
            FeatureContext.Current.Add(Utils.ViewNameKey, manageWebserviceSourceControl);
            FeatureContext.Current.Add(Utils.ViewModelNameKey, manageWebserviceSourceViewModel);
            FeatureContext.Current.Add("updateManager", mockStudioUpdateManager);
            FeatureContext.Current.Add("requestServiceNameViewModel", mockRequestServiceNameViewModel);
            FeatureContext.Current.Add("externalProcessExecutor", mockExecutor);
        }