public void NotReadyToMoveIfInstanceNotSelected()
        {
            Given();
            var view = new StubbedLocalServerPickerView(null)
                .Instance(null);

            When();
            var localServerPickerPage = new LocalServerPickerPage(view, null, null, m_GetLocalInstances);
            var readyToMove = localServerPickerPage.ReadyToMove();

            Then();
            Assert.That(readyToMove, Is.False);
        }
Esempio n. 2
0
        public Form1()
        {
            InitializeComponent();

            var wizardView = new WizardViewWidget();
            var secondPage = new PageExample(null, "second page");
            var firstPage = new PageExample(secondPage, "first page");
            var localInstancePage = new LocalServerPickerPage(new LocalServerPickerWidget(), firstPage,
                                                              new TestConnection(), new GetLocalInstances());
            var introPage = new IntroPageViewModel(new IntroPageWidget(), localInstancePage);
            new WizardViewModel(wizardView, introPage, cancel, cancel);

            Controls.Add(wizardView);
        }
        public void NotReadyToMoveIfUsernameNotSupplied()
        {
            Given();
            var view =
                new StubbedLocalServerPickerView(null)
                    .Instance("soemthingelseelse")
                    .SecurityType(SecurityType.SqlServerAuth)
                    .Password("rocks");

            When();
            var localServerPickerPage = new LocalServerPickerPage(view, null, null, m_GetLocalInstances);
            var readyToMove = localServerPickerPage.ReadyToMove();

            Then();
            Assert.That(readyToMove, Is.False);
        }
        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 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 ShouldReturnWidgetAndNextPageAndFormIsEnabledAndRegisterForEvents()
        {
            Given();
            var widget = new UserControl();
            var view = new StubbedLocalServerPickerView(widget);
            var nextPage = new StubbedPage(null, null, null, null);

            When();
            var localServerPickerPage = new LocalServerPickerPage(view, nextPage, null, m_GetLocalInstances);

            Then();
            Assert.That(view.FormEnabled, Is.EqualTo(EnabledState.Integrated));
            Assert.That(view.OnChangeAction, Is.Not.Null);
            Assert.That(localServerPickerPage.GetControl(), Is.EqualTo(widget));
            Assert.That(localServerPickerPage.GetNextPage(), Is.EqualTo(nextPage));
        }
        public void ShouldReturnCorrectName()
        {
            Given();

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

            Then();
            Assert.That(localServerPickerPage.getName(), Is.EqualTo("Choose Local Server"));
        }
        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();
        }
        public void ReadyToMoveIfInstanceSelectedUsingSqlAuthAndUserPasswordProvided()
        {
            Given();
            var view =
                new StubbedLocalServerPickerView(null)
                    .Instance("soemthingelse")
                    .SecurityType(SecurityType.SqlServerAuth)
                    .UserName("tiest")
                    .Password("rocks");

            When();
            var localServerPickerPage = new LocalServerPickerPage(view, null, null, m_GetLocalInstances);
            var readyToMove = localServerPickerPage.ReadyToMove();

            Then();
            Assert.That(readyToMove, Is.True);
        }
        public void ReadyToMoveIfInstanceSelectedAndUsingIntegratedSecurity()
        {
            Given();
            var view = new StubbedLocalServerPickerView(null)
                .Instance("something");
            view.SecurityType(SecurityType.Integrated);

            When();
            var localServerPickerPage = new LocalServerPickerPage(view, null, null, m_GetLocalInstances);
            var readyToMove = localServerPickerPage.ReadyToMove();

            Then();
            Assert.That(readyToMove, Is.True);
        }