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

            // Insert the duplicate Session data row in the database.
            int duplicateSessionID = SessionTestTable.InsertPlaceholder(sessionCode: "n3p4y556gt9f17hw");

            // Build the Session data row.
            SessionDataRow sessionDataRow = new SessionDataRow();
            sessionDataRow.SessionID = sessionID;
            sessionDataRow.SessionCode = "n3p4y556gt9f17hw";
            sessionDataRow.Name = "Session Bravo";
            sessionDataRow.StartDate = new DateTime(2002, 2, 2);

            // Build the database connection.
            using (DatabaseConnection databaseConnection = new DatabaseConnection(TestDatabase.ConnectionString))
            {
                // Open the database connection.
                databaseConnection.Open().Wait();

                try
                {
                    // Update the Session data row.
                    SessionDataAccessComponent sessionDataAccessComponent = new SessionDataAccessComponent();
                    sessionDataAccessComponent.Update(databaseConnection, sessionDataRow).Wait();

                    // Validate an exception was thrown.
                    Assert.Fail();
                }
                catch (AggregateException ex)
                {
                    // Validate an SQL exception was thrown.
                    Assert.IsInstanceOfType(ex.InnerExceptions[0], typeof(SqlException));
                }
            }
        }
        public void Update_ShouldSucceed()
        {
            // Insert the Session data row in the database.
            int sessionID = SessionTestTable.InsertWithValues(
                "6dk61ufcuzp3f7vs",
                "Session Alpha",
                new DateTime(2001, 1, 1));

            // Build the Session data row.
            SessionDataRow sessionDataRow = new SessionDataRow();
            sessionDataRow.SessionID = sessionID;
            sessionDataRow.SessionCode = "n3p4y556gt9f17hw";
            sessionDataRow.Name = "Session Bravo";
            sessionDataRow.StartDate = new DateTime(2002, 2, 2);

            // Build the database connection.
            using (DatabaseConnection databaseConnection = new DatabaseConnection(TestDatabase.ConnectionString))
            {
                // Open the database connection.
                databaseConnection.Open().Wait();

                // Update the Session data row.
                SessionDataAccessComponent sessionDataAccessComponent = new SessionDataAccessComponent();
                sessionDataAccessComponent.Update(databaseConnection, sessionDataRow).Wait();
            }

            // Validate the Session data row was updated in the database.
            SessionTestTable.AssertPresence(
                sessionID,
                "n3p4y556gt9f17hw",
                "Session Bravo",
                new DateTime(2002, 2, 2));
        }