public void ReadAll_ShouldReturnOneDataRow()
        {
            // Insert the Session data row in the database.
            int sessionID = SessionTestTable.InsertWithValues(
                "6dk61ufcuzp3f7vs",
                "Session Alpha",
                new DateTime(2001, 1, 1));

            // Build the database connection.
            SessionDataRow[] sessionDataRows = null;
            using (DatabaseConnection databaseConnection = new DatabaseConnection(TestDatabase.ConnectionString))
            {
                // Open the database connection.
                databaseConnection.Open().Wait();

                // Read the Session data rows.
                SessionDataAccessComponent sessionDataAccessComponent = new SessionDataAccessComponent();
                sessionDataRows = sessionDataAccessComponent.ReadAll(databaseConnection).Result;
            }

            // Validate the Session data rows.
            Assert.IsNotNull(sessionDataRows);
            Assert.AreEqual(1, sessionDataRows.Length);

            // Validate the first Session data row.
            Assert.AreEqual(sessionID, sessionDataRows[0].SessionID);
            Assert.AreEqual("6dk61ufcuzp3f7vs", sessionDataRows[0].SessionCode);
            Assert.AreEqual("Session Alpha", sessionDataRows[0].Name);
            Assert.AreEqual(new DateTime(2001, 1, 1), sessionDataRows[0].StartDate);
        }
        public void ReadAll_ShouldReturnZeroDataRows()
        {
            // Build the database connection.
            SessionDataRow[] sessionDataRows = null;
            using (DatabaseConnection databaseConnection = new DatabaseConnection(TestDatabase.ConnectionString))
            {
                // Open the database connection.
                databaseConnection.Open().Wait();

                // Read the Session data rows.
                SessionDataAccessComponent sessionDataAccessComponent = new SessionDataAccessComponent();
                sessionDataRows = sessionDataAccessComponent.ReadAll(databaseConnection).Result;
            }

            // Validate the Session data rows.
            Assert.IsNotNull(sessionDataRows);
            Assert.AreEqual(0, sessionDataRows.Length);
        }
        public void ReadAll_ShouldReturnMultipleDataRows()
        {
            // Insert the first Session data row in the database.
            int firstSessionID = SessionTestTable.InsertWithValues(
                "6dk61ufcuzp3f7vs",
                "Session Alpha",
                new DateTime(2001, 1, 1));

            // Insert the second Session data row in the database.
            int secondSessionID = SessionTestTable.InsertWithValues(
                "n3p4y556gt9f17hw",
                "Session Bravo",
                new DateTime(2002, 2, 2));

            // Insert the third Session data row in the database.
            int thirdSessionID = SessionTestTable.InsertWithValues(
                "x36s2tccz8yxp1hq",
                "Session Charlie",
                new DateTime(2003, 3, 3));

            // Build the database connection.
            SessionDataRow[] sessionDataRows = null;
            using (DatabaseConnection databaseConnection = new DatabaseConnection(TestDatabase.ConnectionString))
            {
                // Open the database connection.
                databaseConnection.Open().Wait();

                // Read the Session data rows.
                SessionDataAccessComponent sessionDataAccessComponent = new SessionDataAccessComponent();
                sessionDataRows = sessionDataAccessComponent.ReadAll(databaseConnection).Result;
            }

            // Validate the Session data rows.
            Assert.IsNotNull(sessionDataRows);
            Assert.AreEqual(3, sessionDataRows.Length);

            // Validate the first Session data row.
            Assert.AreEqual(firstSessionID, sessionDataRows[0].SessionID);
            Assert.AreEqual("6dk61ufcuzp3f7vs", sessionDataRows[0].SessionCode);
            Assert.AreEqual("Session Alpha", sessionDataRows[0].Name);
            Assert.AreEqual(new DateTime(2001, 1, 1), sessionDataRows[0].StartDate);

            // Validate the second Session data row.
            Assert.AreEqual(secondSessionID, sessionDataRows[1].SessionID);
            Assert.AreEqual("n3p4y556gt9f17hw", sessionDataRows[1].SessionCode);
            Assert.AreEqual("Session Bravo", sessionDataRows[1].Name);
            Assert.AreEqual(new DateTime(2002, 2, 2), sessionDataRows[1].StartDate);

            // Validate the third Session data row.
            Assert.AreEqual(thirdSessionID, sessionDataRows[2].SessionID);
            Assert.AreEqual("x36s2tccz8yxp1hq", sessionDataRows[2].SessionCode);
            Assert.AreEqual("Session Charlie", sessionDataRows[2].Name);
            Assert.AreEqual(new DateTime(2003, 3, 3), sessionDataRows[2].StartDate);
        }