// Tests for Butterfly queries
        public static void butterflyQueryTests(DataManager dm, bool add, bool get, bool increment)
        {
            ButterflyQueryUnitTest bqTest = new ButterflyQueryUnitTest(dm.getConnection());
            if (add)
            {
                Console.WriteLine("Test 1: Add Butterfly");
                if (bqTest.unitTestAddButterfly(19, "Real Cool Butterfly"))
                    Console.WriteLine("Test 1: Success");
                else
                    Console.WriteLine("Test 1: Success");
            }

            if (get)
            {
                Console.WriteLine("Test 2: Get Butterfly");
                if (bqTest.unitTestGetButterfly(17))
                    Console.WriteLine("Test 2: Success");
                else
                    Console.WriteLine("Test 2: Success");

                Console.WriteLine("Test 3: Get All Butterflies");
                if (bqTest.unitTestGetAll())
                    Console.WriteLine("Test 3: Success");
                else
                    Console.WriteLine("Test 3: Success");

                Console.WriteLine("Test 4: Get All Tags");
                if (bqTest.unitTestGetAllTags())
                    Console.WriteLine("Test 4: Success");
                else
                    Console.WriteLine("Test 4: Success");
            }

            if (increment)
            {
                Console.WriteLine("Test 5: Increment sightings");
                if (bqTest.unitTestIncrementSightings(1))
                    Console.WriteLine("Test 5: Succesfully incremented");
                else
                    Console.WriteLine("Test 5: Unable to increment");
            }
        }
        // Tests for Common Sightings queries
        public static void commonSightingsTests(DataManager dm)
        {
            CommonSightingsQueryUnitTest test = new CommonSightingsQueryUnitTest(dm.getConnection());
            Console.WriteLine("Test 1: Get top locations");
            try
            {
                test.testByLocation();
                Console.WriteLine("Test 1: Success");
            }
            catch (MySqlException ex)
            {
                Console.WriteLine("Test 1: Failed");
                Console.WriteLine("    " + ex.Message);
            }

            Console.WriteLine("Test 2: Get top dates");
            try
            {
                test.testByDates();
                Console.WriteLine("Test 2: Success");
            }
            catch (MySqlException ex)
            {
                Console.WriteLine("Test 2: Failed");
                Console.WriteLine("    " + ex.Message);
            }

            Console.WriteLine("Test 3: Get top species");
            try
            {
                test.testBySpecies();
                Console.WriteLine("Test 3: Success");
            }
            catch (MySqlException ex)
            {
                Console.WriteLine("Test 3: Failed");
                Console.WriteLine("    " + ex.Message);
            }
        }
        public GUI_SightingHistory()
        {
            dm = new DataManager();
            connection = dm.getConnection();
            InitializeComponent();

            TrackingEntryQuery query = new TrackingEntryQuery(connection);
            List<TrackingEntry> entries = new List<TrackingEntry>();
            entries = query.getAll();

            if (entries != null)
            {
                foreach (TrackingEntry entry in entries)
                {
                    int index = sightinghistorygrid.Rows.Add();
                    DataGridViewRow row = sightinghistorygrid.Rows[index];
                    row.Cells["Column1"].Value = entry.species;
                    row.Cells["Column2"].Value = entry.tagNumber;
                    row.Cells["Column3"].Value = entry.entryDate;
                    row.Cells["Column4"].Value = entry.taggerName;
                    row.Cells["Column5"].Value = entry.taggerID;
                }
            }
        }
 public GUI_CommonSightings()
 {
     dm = new DataManager();
     connection = dm.getConnection();
     InitializeComponent();
 }
 public GUI_TrackingEntry()
 {
     dm = new DataManager();
     connection = dm.getConnection();
     InitializeComponent();
 }
 public GUI_MigrationRoute()
 {
     dm = new DataManager();
     connection = dm.getConnection();
     InitializeComponent();
 }
        public static void trackingEntryTests(DataManager dm, bool add, bool getByEntryID, bool getAll,
            bool getByTag, bool getByTagOrdered, bool getInterval, bool getOn, bool getBySpecies,
            bool getByLocation, bool getByLocationOrdered, bool getTagged, bool getNotTagged, bool getByType,
            bool getByLocationCountry, bool getByLocationStateCountry)
        {
            TrackingEntryUnitTest test = new TrackingEntryUnitTest(dm.getConnection());
            TrackingEntry entry = new TrackingEntry();

            entry.taggerID = 1;
            entry.type = 'T';
            entry.isTagged = true;
            entry.taggerName = "Sean Gallagher";
            entry.entryDate = "2015-12-12 03:19:00";
            entry.species = "Monarch";
            entry.tagNumber = 1;

            Console.WriteLine("\n--TRACKING ENTRY UNIT TESTS--");

            if (add)
            {
                Console.WriteLine("Test 1: Add Tracking Entry");
                if (test.unitTestAddEntry(entry))
                    Console.WriteLine("    Added successfully");
                else
                    Console.WriteLine("    Not added");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");
            }

            if (getByEntryID)
            {
                Console.WriteLine("Test 2: Get Tracking Entry by entry ID");
                if (test.unitTestGetEntry(4))
                    Console.WriteLine("Test 2: Success");
                else
                    Console.WriteLine("Test 2: Entry not found");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");
            }

            if (getAll)
            {
                Console.WriteLine("Test 3: Get all tracking entries");
                if (test.unitTestGetAll())
                    Console.WriteLine("Test 3: Success");
                else
                    Console.WriteLine("Test 3: No entries found");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");
            }

            if (getByTag)
            {
                Console.WriteLine("Test 4: Get all by tag number");
                if (test.unitTestGetByTag(126))
                    Console.WriteLine("Test 4: Success");
                else
                    Console.WriteLine("Test 4: No entries found");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");
            }

            if (getByTagOrdered)
            {
                Console.WriteLine("Test 5: Get all by tag number in ascending order");
                if (test.unitTestGetByTagOrdered(126))
                    Console.WriteLine("Test 5: Success");
                else
                    Console.WriteLine("Test 5: No entries found");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");
            }

            if (getInterval)
            {
                Console.WriteLine("Test 6: Get all entries in an interval");
                if (test.unitTestGetInterval("2015-11-1", "2015-11-20"))
                    Console.WriteLine("Test 6: Success");
                else
                    Console.WriteLine("Test 6: No entries found");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");
            }

            if (getOn)
            {
                Console.WriteLine("Test 7: Get all entries on a specific date");
                if (test.unitTestGetOn("2015-11-1"))
                    Console.WriteLine("Test 7: Success");
                else
                    Console.WriteLine("Test 7: No entries found");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");
            }

            if (getBySpecies)
            {
                Console.WriteLine("Test 8: Get all entries by species");
                if (test.unitTestGetBySpecies("Monarch"))
                    Console.WriteLine("Test 8: Success");
                else
                    Console.WriteLine("Test 8: No entries found");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");

                Console.WriteLine("Test 8: Get all entries by species and date");
                if (test.unitTestGetBySpecies("Monarch", "2015-12-13"))
                    Console.WriteLine("Test 8: Success");
                else
                    Console.WriteLine("Test 8: No entries found");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");
            }

            if (getByLocation)
            {
                Console.WriteLine("Test 9: Get all entries by location");
                if (test.unitTestGetByLocation("Dearborn", "MI", "USA"))
                    Console.WriteLine("Test 9: Success");
                else
                    Console.WriteLine("Test 9: No entries found");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");
            }

            if (getByLocationOrdered)
            {
                Console.WriteLine("Test 10: Get all entries by location in ascending order by date");
                if (test.unitTestGetByLocationOrdered("Dearborn", "MI", "USA"))
                    Console.WriteLine("Test 10: Success");
                else
                    Console.WriteLine("Test 10: No entries found");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");

                Console.WriteLine("Test 10: Get all entries by location (state and country only)"
                    + " in ascending order by date");
                if (test.unitTestGetByLocationOrdered("MI", "USA"))
                    Console.WriteLine("Test 10: Success");
                else
                    Console.WriteLine("Test 10: No entries found");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");

                Console.WriteLine("Test 10: Get all entries by location (country only) in ascending order by date");
                if (test.unitTestGetByLocationOrdered("USA"))
                    Console.WriteLine("Test 10: Success");
                else
                    Console.WriteLine("Test 10: No entries found");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");
            }

            if (getTagged)
            {
                Console.WriteLine("Test 11: Get all tagged entries");
                if (test.unitTestGetTagged(true))
                    Console.WriteLine("Test 11: Success");
                else
                    Console.WriteLine("Test 11: No entries found");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");
            }

            if (getNotTagged)
            {
                Console.WriteLine("Test 12: Get all entries that are not tagged");
                if (test.unitTestGetTagged(false))
                    Console.WriteLine("Test 12: Success");
                else
                    Console.WriteLine("Test 12: No entries found");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");
            }

            if (getByType)
            {
                Console.WriteLine("Test 13: Get all entries by type T");
                if (test.unitTestGetByType('T'))
                    Console.WriteLine("Test 13: Success");
                else
                    Console.WriteLine("Test 13: No entries found");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");

                Console.WriteLine("Test 14: Get all entries by type S");
                if (test.unitTestGetByType('S'))
                    Console.WriteLine("Test 14: Success");
                else
                    Console.WriteLine("Test 14: No entries found");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");
            }

            if (getByLocationCountry)
            {
                Console.WriteLine("Test 15: Get all entries by location (country only)");
                if (test.unitTestGetByLocation("USA"))
                    Console.WriteLine("Test 15: Success");
                else
                    Console.WriteLine("Test 15: No entries found");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");
            }

            if (getByLocationStateCountry)
            {
                Console.WriteLine("Test 16: Get all entries by location (state and country only");
                if (test.unitTestGetByLocation("MI", "USA"))
                    Console.WriteLine("Test 16: Success");
                else
                    Console.WriteLine("Test 16: No entries found");
                Console.Write("-----------------------------------------");
                Console.WriteLine("-----------------------------------------");
            }
        }
        public static void personTests(DataManager dm)
        {
            PersonQueryUnitTest test = new PersonQueryUnitTest(dm.getConnection());
            Person person = new Person();

            person.name = "Sean Gallagher";

            Console.WriteLine("Test 1: Add Person");
            if (test.unitTestAddPerson(person))
                Console.WriteLine("Test 1: Success");
            else
                Console.WriteLine("Test 1: Failed");

            Console.WriteLine("Test 2: Get Person (by tag)");
            if (test.unitTestGetPerson(1))
                Console.WriteLine("Test 2: Success");
            else
                Console.WriteLine("Test 2: Failed");

            Console.WriteLine("Test 3: Get Person (by name)");
            if (test.unitTestGetPerson(person.name))
                Console.WriteLine("Test 3: Success");
            else
                Console.WriteLine("Test 3: Failed");

            Console.WriteLine("Test 4: Get All");
            if (test.unitTestGetAll())
                Console.WriteLine("Test 4: Success");
            else
                Console.WriteLine("Test 4: Failed");
        }