public void A_SQLCEDatabaseLoader_Is_Returned()
        {
            IDatabaseForm form = MockRepository.GenerateMock<IDatabaseForm>();
            IMainPanel panel = MockRepository.GenerateMock<IMainPanel>();

            DatabasePresenter presenter = new DatabasePresenter(panel, form);

            form.Stub(t => t.SelectedDatabaseType).Return(DatabaseTypes.SQLCE);
            form.Stub(t => t.SelectedDatabase).Return("1Table3Columns.sdf");

            IDatabaseLoader loader = presenter.CreateDatabaseLoader();
            Assert.That(loader, Is.Not.Null);
            Assert.That(loader, Is.TypeOf(typeof(SQLCEDatabaseLoader)));

            // Will throw an error if the database connection could not be established.
            loader.TestConnection();

            IDatabase db = loader.LoadDatabase();

            Assert.That(db.Name, Is.EqualTo("1Table3Columns"));
            Assert.That(db.Tables, Has.Count(1)); // Basic check to see if we got the correct database back.
        }
        public void A_SQLServer2005DatabaseLoader_Is_Returned()
        {
            IDatabaseForm form = MockRepository.GenerateMock<IDatabaseForm>();
            IMainPanel panel = MockRepository.GenerateMock<IMainPanel>();

            DatabasePresenter presenter = new DatabasePresenter(panel, form);

            form.Stub(t => t.SelectedDatabaseType).Return(DatabaseTypes.SQLServer2005);
            form.Stub(t => t.ConnectionStringHelper).Return(new ConnectionStringHelper
                                                                {
                                                                    CurrentDbType = DatabaseTypes.SQLServer2005,
                                                                    DatabaseName = "TestDatabase",
                                                                    Password = "******",
                                                                    ServerName = ".",
                                                                    UseFileName = false,
                                                                    UseIntegratedSecurity = false,
                                                                    UserName = "******"
                                                                });

            IDatabaseLoader loader = presenter.CreateDatabaseLoader();
            Assert.That(loader, Is.Not.Null);
            Assert.That(loader, Is.TypeOf(typeof(SQLServer2005DatabaseLoader)));
        }