public void BatchTempInsert_InsertObjectCollectionAndSelectItBack()
        {
            ICollection<ExampleCalendarEvent> events = new ExampleCalendarEvent[]
            {
                new ExampleCalendarEvent()
                {
                    ExampleCalendarEventId = 1,
                    Title = "ZocTalk",
                    TimeUtc = new DateTime(2015, 1, 9, 22, 0, 0),
                    Address = "568 Broadway, New York, NY 10012",
                    Priority = EventPriority.Medium
                },
                new ExampleCalendarEvent()
                {
                    ExampleCalendarEventId = 2,
                    Title = "Meet with financial data vendor",
                    TimeUtc = new DateTime(2015, 2, 12, 18, 0, 0),
                    Address = "55 Water St, New York, NY 10041",
                    Priority = EventPriority.Low,
                    CalendarEventSeriesId = 123
                },
                new ExampleCalendarEvent()
                {
                    ExampleCalendarEventId = 3,
                    Title = "Birthday Party",
                    TimeUtc = new DateTime(2015, 12, 11, 23, 0, 0),
                    Address = "111 8th Ave, New York, NY 10011",
                    Description = "It's going to be a blast!",
                    Priority = EventPriority.High
                }
            };
            ICollection<ExampleCalendarEvent> eventsFromDb;

            using (var conn = Connection())
            {
                conn.Open();
                var bulkCopy = new zd.SqlBulkCopyHelper(conn);

                const string tempTableName = "#events";
                bulkCopy.BulkTempInsert(events, tempTableName);

                const string sqlSelect = "Select * From " + tempTableName;
                var cmd = new zd.SqlCommandHelper(sqlSelect, conn);
                eventsFromDb = cmd.FetchList<ExampleCalendarEvent>();
            }

            CollectionAssert.AreEquivalent(events, eventsFromDb, "BatchTempInsert should create a temp table and populate it with entities from the given list.");
        }
        public void BatchTempInsert_InsertPrimitiveCollectionAndSelectItBack()
        {
            int[] ids = new int[]
            {
                1,
                1,
                2,
                3,
                5,
                8,
                13
            };
            ICollection<int> idsFromDb;
            
            using (var conn = Connection())
            {
                conn.Open();
                var bulkCopy = new zd.SqlBulkCopyHelper(conn);

                const string tempTableName = "#ids";
                bulkCopy.BulkTempInsert(ids, tempTableName);

                const string sqlSelect = "Select * From " + tempTableName;
                var cmd = new zd.SqlCommandHelper(sqlSelect, conn);
                idsFromDb = cmd.FetchList<int>();
            }

            CollectionAssert.AreEquivalent(ids, idsFromDb, "BatchTempInsert should create a temp table and populate it with the integers from the given list.");
        }