public void Can_catch_execute_sql_command()
        {
            var mock = MockListener();

            DbTracing.AddListener(mock.Object);
            try
            {
                using (var context = new CodeFirstContext())
                {
                    context.Database.ExecuteSqlCommand("select 1; select @date", new SqlParameter("date", DateTime.Now));

                    context.SaveChanges();
                }
            }
            finally
            {
                DbTracing.RemoveListener(mock.Object);
            }

            mock.Verify();
        }
        public void Can_catch_entity_framework_command()
        {
            var mock = MockListener(reader: true);

            DbTracing.AddListener(mock.Object);
            try
            {
                using (var context = new CodeFirstContext())
                {
                    context.TestEntity1.Add(new TestEntity1());
                    context.TestEntity2.Add(new TestEntity2());

                    context.SaveChanges();
                }
            }
            finally
            {
                DbTracing.RemoveListener(mock.Object);
            }

            mock.Verify();
        }