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);
        }
        public void SetUp()
        {
            m_TestConnection          = m_Mocks.StrictMock <TestConnection>();
            m_PassingConnectionStatus = new ConnectionStatus(true, "", new List <DbObjectName>(), "datapath");
            m_FailingConnectionStatus = new ConnectionStatus(false, "you're just plain wrong", new List <DbObjectName>(), "");
            m_DefaultView             = new StubbedLocalServerPickerView(null)
                                        .Instance("instance")
                                        .SecurityType(SecurityType.SqlServerAuth)
                                        .UserName("tiestv")
                                        .Password("rocks!");

            m_DefaultConnection = new Connection("instance", SecurityType.SqlServerAuth, "tiestv", "rocks!");
            m_GetLocalInstances = m_Mocks.PartialMock <StubbedGetLocalInstances>();
        }
        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);
        }
        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);
        }
        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 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 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 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 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 SetUp()
        {
            m_TestConnection = m_Mocks.StrictMock<TestConnection>();
            m_PassingConnectionStatus = new ConnectionStatus(true, "", new List<DbObjectName>(), "datapath");
            m_FailingConnectionStatus = new ConnectionStatus(false, "you're just plain wrong", new List<DbObjectName>(), "");
            m_DefaultView = new StubbedLocalServerPickerView(null)
                .Instance("instance")
                .SecurityType(SecurityType.SqlServerAuth)
                .UserName("tiestv")
                .Password("rocks!");

            m_DefaultConnection = new Connection("instance", SecurityType.SqlServerAuth, "tiestv", "rocks!");
            m_GetLocalInstances = m_Mocks.PartialMock<StubbedGetLocalInstances>();
        }
        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);
        }