Exemplo n.º 1
0
        public static void RunTests()
        {
            // for the case where FilepathDeletedFilesDir isn't set,
            // we shouldn't leave junk behind.
            var localTrash            = Path.Combine(Configs.Current.Directory, "(deleted)");
            var shouldCleanLocalTrash = !Directory.Exists(localTrash);

            if (Utils.GetSoftDeleteDestination("abc" + Utils.Sep + "abc") == null)
            {
                Utils.MessageBox("Skipping tests until a trash directory is chosen.");
                return;
            }

            try
            {
                string dir = TestUtil.GetTestWriteDirectory();

                if (Directory.Exists(dir))
                {
                    Directory.Delete(dir, true);
                }
            }
            catch (Exception)
            {
                Utils.MessageErr("Could not clear unit test directory. Is another instance of " +
                                 "coordinate pictures already running?");
                return;
            }

            Configs.Current.SuppressDialogs = true;
            try
            {
                TestUtil.CallAllTestMethods(typeof(CoordinatePicturesTests), null);
                TestUtil.CallAllTestMethods(typeof(CoordinateFilesTests), null);
            }
            finally
            {
                Configs.Current.SuppressDialogs = false;

                if (shouldCleanLocalTrash && Directory.Exists(localTrash))
                {
                    Directory.Delete(localTrash, false);
                }
            }
        }