Esempio n. 1
0
        public void EditConnectionInfoCommandExecute_ShouldLeaveStartConnection()
        {
            //Arange
            string projectConfigPath = "testProjectConfigPath";
            string projectName       = "testProjectName";
            string projectFullName   = "testProjectFullName";
            DebugMethodViewModel debugMethodViewModel = new DebugMethodViewModel(authenticationManager,
                                                                                 this.projectConfigurationManager,
                                                                                 this.projectConfiguration,
                                                                                 this.methodInformation,
                                                                                 this.dialogFactory,
                                                                                 this.methodCode,
                                                                                 projectConfigPath,
                                                                                 projectName,
                                                                                 projectFullName);

            LoginViewTestAdapter adapter = new LoginViewTestAdapter(false);

            this.dialogFactory.GetLoginView(this.projectConfiguration, projectName, projectFullName).Returns(adapter);

            //Act
            debugMethodViewModel.EditConnectionInfoCommand.Execute(null);

            //Assert
            Assert.AreEqual(this.connectionInfos.First(), debugMethodViewModel.ConnectionInformation);
        }
Esempio n. 2
0
        public void Ctor_ShouldInitExpectedProperty()
        {
            //Arange
            string expectedMethodContext = $"<Item action=\"{methodInformation.MethodName}\" type=\"Method\" />";

            //Act
            DebugMethodViewModel debugMethodViewModel = new DebugMethodViewModel(authenticationManager,
                                                                                 this.projectConfigurationManager,
                                                                                 this.projectConfiguration,
                                                                                 this.methodInformation,
                                                                                 this.dialogFactory,
                                                                                 this.methodCode,
                                                                                 "testProjectConfigPath",
                                                                                 "testProjectName",
                                                                                 "testProjectFullName");

            //Assert
            Assert.AreEqual(this.methodCode, debugMethodViewModel.MethodCode);
            Assert.AreEqual(expectedMethodContext, debugMethodViewModel.MethodContext);
            Assert.AreEqual(this.methodInformation.MethodType, debugMethodViewModel.MethodType);
            Assert.AreEqual(this.methodInformation.MethodLanguage, debugMethodViewModel.MethodLanguage);
            Assert.AreEqual(this.methodInformation.EventData.ToString(), debugMethodViewModel.SelectedEventSpecificData);
            Assert.AreEqual(this.methodInformation.MethodName, debugMethodViewModel.MethodName);
            Assert.AreEqual(this.connectionInfos.First(), debugMethodViewModel.ConnectionInformation);
        }
Esempio n. 3
0
        public IViewAdaper <DebugMethodView, DebugMethodViewResult> GetDebugMethodView(IProjectConfigurationManager projectConfigurationManager, IProjectConfiguraiton projectConfiguration, MethodInfo methodInformation, string methodCode, string projectConfigPath, string projectName, string projectFullName)
        {
            var viewModel = new DebugMethodViewModel(authManager, projectConfigurationManager, projectConfiguration, methodInformation, this, methodCode, projectConfigPath, projectName, projectFullName);
            var view      = new DebugMethodView();

            view.DataContext = viewModel;

            AttachToParentWindow(view);
            return(new DebugMethodViewAdapter(view));
        }
        public IViewAdaper <DebugMethodView, DebugMethodViewResult> GetDebugMethodView(IVsUIShell uiShell, IProjectConfigurationManager projectConfigurationManager, IProjectConfiguraiton projectConfiguration, MethodInfo methodInformation, string methodCode, string projectConfigPath, string projectName, string projectFullName)
        {
            var viewModel = new DebugMethodViewModel(authManager, projectConfigurationManager, projectConfiguration, methodInformation, methodCode, projectConfigPath, projectName, projectFullName);
            var view      = new DebugMethodView();

            view.DataContext = viewModel;

            IntPtr hwnd;

            uiShell.GetDialogOwnerHwnd(out hwnd);
            var windowInteropHelper = new WindowInteropHelper(view);

            windowInteropHelper.Owner = hwnd;

            return(new DebugMethodViewAdapter(view));
        }
 public void Ctor_ShouldProjectConfigurationManagerThrowArgumentNullException()
 {
     //Assert
     Assert.Throws <ArgumentNullException>(() =>
     {
         //Act
         DebugMethodViewModel debugMethodViewModel = new DebugMethodViewModel(this.authenticationManager,
                                                                              null,
                                                                              this.methodInformation,
                                                                              this.dialogFactory,
                                                                              "testMethodCode",
                                                                              "testProjectConfigPath",
                                                                              "testProjectName",
                                                                              "testProjectFullName");
     });
 }
Esempio n. 6
0
        public void EditConnectionInfoCommandExecute_ShouldSetNewConnectionInConnectionInformation()
        {
            //Arange
            string projectConfigPath = "testProjectConfigPath";
            string projectName       = "testProjectName";
            string projectFullName   = "testProjectFullName";

            DebugMethodViewModel debugMethodViewModel = new DebugMethodViewModel(authenticationManager,
                                                                                 this.projectConfigurationManager,
                                                                                 this.projectConfiguration,
                                                                                 this.methodInformation,
                                                                                 this.dialogFactory,
                                                                                 this.methodCode,
                                                                                 projectConfigPath,
                                                                                 projectName,
                                                                                 projectFullName);

            ConnectionInfo newConnection = new ConnectionInfo()
            {
                Login          = "******",
                Database       = "newTestDataBase",
                ServerUrl      = "newTestServerUrl",
                LastConnection = true
            };

            LoginViewTestAdapter adapter = new LoginViewTestAdapter(true);

            this.dialogFactory.GetLoginView(this.projectConfiguration, projectName, projectFullName).Returns(adapter);
            this.dialogFactory.When(x => x.GetLoginView(this.projectConfiguration, projectName, projectFullName)).Do(callback =>
            {
                connectionInfos[0].LastConnection = false;
                connectionInfos.Add(newConnection);
            });

            //Act
            debugMethodViewModel.EditConnectionInfoCommand.Execute(null);

            //Assert
            Assert.AreEqual(newConnection, debugMethodViewModel.ConnectionInformation);
        }