Пример #1
0
 public void GetCustomerCountSecondCallExecutesNonQueryTest()
 {
     var listener = new TestTraceListener();
     Trace.Listeners.Add(listener);
     var db = DatabaseHelper.Open();
     db.GetCustomerCount();
     Assert.IsFalse(listener.Output.Contains("ExecuteNonQuery"));
     db.GetCustomerCount();
     Assert.IsTrue(listener.Output.Contains("ExecuteNonQuery"));
     Trace.Listeners.Remove(listener);
 }
Пример #2
0
 public void GetCustomerCountSecondCallExecutesNonQueryTest()
 {
     SimpleDataTraceSources.TraceSource.Switch.Level = SourceLevels.All;
     var listener = new TestTraceListener();
     SimpleDataTraceSources.TraceSource.Listeners.Add(listener);
     var db = DatabaseHelper.Open();
     db.GetCustomerCount();
     Assert.IsFalse(listener.Output.Contains("ExecuteNonQuery"));
     db.GetCustomerCount();
     Assert.IsTrue(listener.Output.Contains("ExecuteNonQuery"));
     SimpleDataTraceSources.TraceSource.Listeners.Remove(listener);
 }
Пример #3
0
        public void GetCustomerCountSecondCallExecutesNonQueryTest()
        {
            SimpleDataTraceSources.TraceSource.Switch.Level = SourceLevels.All;
            var listener = new TestTraceListener();

            SimpleDataTraceSources.TraceSource.Listeners.Add(listener);
            var db = DatabaseHelper.Open();

            db.GetCustomerCount();
            Assert.IsFalse(listener.Output.Contains("ExecuteNonQuery"));
            db.GetCustomerCount();
            Assert.IsTrue(listener.Output.Contains("ExecuteNonQuery"));
            SimpleDataTraceSources.TraceSource.Listeners.Remove(listener);
        }
Пример #4
0
        public void OrderByOnJoinedColumnShouldUseJoinedColumn()
        {
            var traceListener = new TestTraceListener();

            Trace.Listeners.Add(traceListener);
            var db = DatabaseHelper.Open();

            var q = db.Employees.Query().LeftJoin(db.Employees.As("Manager"), Id: db.Employees.ManagerId);

            q = q.Select(db.Employees.Name, q.Manager.Name.As("Manager"));
            List <dynamic> employees = q.OrderBy(q.Manager.Name).ToList();

            Trace.Listeners.Remove(traceListener);
            Assert.Greater(traceListener.Output.IndexOf("order by [manager].[name]", StringComparison.OrdinalIgnoreCase), 0);
        }
Пример #5
0
        public void OrderByOnJoinedColumnShouldUseJoinedColumn()
        {
            var traceListener = new TestTraceListener();
            Trace.Listeners.Add(traceListener);
            var db = DatabaseHelper.Open();

            var q = db.Employees.Query().LeftJoin(db.Employees.As("Manager"), Id: db.Employees.ManagerId);
            q = q.Select(db.Employees.Name, q.Manager.Name.As("Manager"));
            List<dynamic> employees = q.OrderBy(q.Manager.Name).ToList();
            Trace.Listeners.Remove(traceListener);
            Assert.Greater(traceListener.Output.IndexOf("order by [manager].[name]", StringComparison.OrdinalIgnoreCase), 0);
        }