コード例 #1
0
 public void Setup()
 {
     ConfigFilePath = Path.Combine(
         TestSession.DatabaseParentFolderPath, "DatabaseConfig.xml");
     DatabaseFolderPath = Path.Combine(
         TestSession.DatabaseParentFolderPath, "Connection Test Database");
     TearDown(); // Delete the config file and database folder if they exist.
     Connection = new TestDatabaseConnection(ConfigFilePath, DatabaseFolderPath);
 }
コード例 #2
0
        public void SimulateReleaseBuild()
        {
            Connection = new TestDatabaseConnection(ConfigFilePath,
                                                    DatabaseConfig.InsertDatabaseFolderPathHere);
            // Neither the configuration file nor the database folder exist.
            var exception = Assert.Catch <ApplicationException>(
                () => Connection.Open(),
                "Open should have thrown ApplicationException for missing configuration file.");

            Assert.IsTrue(
                exception.Message.StartsWith("Please edit database configuration file '"),
                "Missing configuration file message");
            // The configuration file has been created but the database folder path has not
            // been specified.  If the user attempts to reload the application without having
            // edited the configuration file to specify the database folder path, the
            // application load should fail with the same error message as before.
            exception = Assert.Catch <ApplicationException>(
                () => Connection.Open(),
                "Open should have thrown ApplicationException for unspecified database folder path.");
            Assert.IsTrue(
                exception.Message.StartsWith("Please edit database configuration file '"),
                "Unspecified database folder path file message");
        }