Example #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);
        }
Example #2
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);
        }