public void PassesPostValidationIfConnectionSucceeds()
        {
            Given();
            var postValidateCalled = false;

            Expect.Call(m_TestConnection.Test(m_DefaultConnection)).Return(m_PassingConnectionStatus);

            When();
            var localServerPickerPage = new LocalServerPickerPage(m_DefaultView, null, m_TestConnection, m_GetLocalInstances);

            localServerPickerPage.PostValidate(() => { postValidateCalled = true; });

            Then();
            Assert.That(postValidateCalled, Is.True);
        }
        public void FailsPostValidationIfConnectionFailsAndProvidesWarningToUser()
        {
            Given();
            var postValidateCalled = false;

            Expect.Call(m_TestConnection.Test(m_DefaultConnection)).Return(m_FailingConnectionStatus);

            When();
            var localServerPickerPage = new LocalServerPickerPage(m_DefaultView, null, m_TestConnection, m_GetLocalInstances);

            localServerPickerPage.PostValidate(() => { postValidateCalled = true; });

            Then();
            Assert.That(postValidateCalled, Is.False);
            Assert.That(m_DefaultView.FormEnabled, Is.EqualTo(EnabledState.Integrated));
            Assert.That(m_DefaultView.WarningText, Is.EqualTo(m_FailingConnectionStatus.ErrorMessage));
        }
        public void ShouldConstructConnectionInformationFromView()
        {
            Given();
            var connection = new Connection(
                m_DefaultView.GetInstance(),
                m_DefaultView.GetSecurityType(),
                m_DefaultView.GetUserName(),
                m_DefaultView.GetPassword());

            Expect.Call(m_TestConnection.Test(connection)).Return(m_PassingConnectionStatus);

            When();
            var localServerPickerPage = new LocalServerPickerPage(m_DefaultView, null, m_TestConnection, m_GetLocalInstances);

            localServerPickerPage.PostValidate(() => { });

            Then();
        }