public void GivenICreateNewServerSourceToGendevAs(string sourceName) { var serverSource = new Dev2.Common.Interfaces.Core.ServerSource { Name = sourceName }; ScenarioContext.Current.Add("serverSource", serverSource); }
public void GivenIOpenServerSource(string editingServerSource) { var manageServerControl = ScenarioContext.Current.Get <ManageServerControl>(Core.Utils.ViewNameKey); var mockStudioUpdateManager = new Mock <IManageServerSourceModel>(); mockStudioUpdateManager.Setup(model => model.ServerName).Returns("localhost"); mockStudioUpdateManager.Setup(model => model.GetComputerNames()).Returns(new List <string> { "rsaklfhuggspc", "barney", "SANDBOX-1" }); var mockEventAggregator = new Mock <IEventAggregator>(); var mockExecutor = new Mock <IExternalProcessExecutor>(); var serverSourceDefinition = new Dev2.Common.Interfaces.Core.ServerSource { Name = "ServerSource", Address = "https://SANDBOX-1:3143", ServerName = "SANDBOX-1", AuthenticationType = AuthenticationType.User, UserName = "******", Password = "******" }; var externalServerSourceDefinition = new Dev2.Common.Interfaces.Core.ServerSource { Name = "TestWarewolf", Address = "http://test-warewolf.cloudapp.net:3142", ServerName = "test-warewolf.cloudapp.net", AuthenticationType = AuthenticationType.Public }; Dev2.Common.Interfaces.Core.ServerSource serverSource; switch (editingServerSource) { case "ServerSource": serverSource = serverSourceDefinition; break; case "TestWarewolf": serverSource = externalServerSourceDefinition; break; default: serverSource = serverSourceDefinition; break; } mockStudioUpdateManager.Setup(model => model.FetchSource(It.IsAny <Guid>())) .Returns(serverSource); FeatureContext.Current["svrsrc"] = serverSource; var viewModel = GetViewModel(manageServerControl); var manageServerSourceViewModel = new ManageNewServerViewModel(mockStudioUpdateManager.Object, mockEventAggregator.Object, serverSource, new SynchronousAsyncWorker(), mockExecutor.Object); manageServerControl.EnterPassword(manageServerSourceViewModel.Password); manageServerControl.EnterUserName(manageServerSourceViewModel.UserName); manageServerControl.SetPort(manageServerSourceViewModel.SelectedPort); manageServerControl.SetProtocol(manageServerSourceViewModel.Protocol); manageServerControl.SetAuthenticationType(manageServerSourceViewModel.AuthenticationType); manageServerControl.EnterServerName(manageServerSourceViewModel.ServerName.Name); manageServerControl.SelectServer(manageServerSourceViewModel.ServerName.Name); viewModel.Password = manageServerSourceViewModel.Password; viewModel.UserName = manageServerSourceViewModel.UserName; viewModel.Protocol = manageServerSourceViewModel.Protocol; viewModel.AuthenticationType = manageServerSourceViewModel.AuthenticationType; viewModel.ServerName = manageServerSourceViewModel.ServerName; viewModel.Header = manageServerSourceViewModel.Header; viewModel.HeaderText = manageServerSourceViewModel.HeaderText; viewModel.Item = manageServerSourceViewModel.Item; }