Esempio n. 1
0
        public void TestLocking()
        {
            switch (Startup.ServerType)
            {
            case Data.Driver.DbServerType.SqlCe:
            case Data.Driver.DbServerType.Sqlite:
                return; //do not support locks
            }
            if (File.Exists(_logFileName))
            {
                File.Delete(_logFileName);
            }
            Startup.DropSchemaObjects("lck");
            _app = new LockTestApp();
            Startup.ActivateApp(_app);

            //Run with locks - we should see no errors
            RunTests(LockOptions.SharedRead, LockOptions.ForUpdate, 30, 50);
            Assert.AreEqual(0, _updateErrorCount, "Expected no update errors");
            Assert.AreEqual(0, _sumErrorCount, "Expected no sum errors");

            //Uncomment to see errros when run without locks; commented to save time of running unit tests

            /*
             * //Run without locks - we should see multiple errors; using more threads to get errors for sure
             * RunTests(LockOptions.None, LockOptions.None, 40, 50);
             * var note = " Note: this can happen occasionally, ignore.";
             * Assert.IsTrue(_updateErrorCount > 0, "Expected some update errors." + note);
             * Assert.IsTrue(_sumErrorCount > 0, "Expected some sum errors." + note);
             */
        }//method
Esempio n. 2
0
        public void TestLocking()
        {
            switch (SetupHelper.ServerType) {
            case Data.Driver.DbServerType.SqlCe:
            case Data.Driver.DbServerType.Sqlite:
              return; //do not support locks
              }
              if (File.Exists(_logFileName))
            File.Delete(_logFileName);
              SetupHelper.DropSchemaObjects("lck");
              _app = new LockTestApp();
              SetupHelper.ActivateApp(_app);

              //Run with locks - we should see no errors
              RunTests(LockOptions.SharedRead, LockOptions.ForUpdate, 30, 50);
              Assert.AreEqual(0, _updateErrorCount, "Expected no update errors");
              Assert.AreEqual(0, _sumErrorCount, "Expected no sum errors");

              //Uncomment to see errros when run without locks; commented to save time of running unit tests
              /*
              //Run without locks - we should see multiple errors; using more threads to get errors for sure
              RunTests(LockOptions.None, LockOptions.None, 40, 50);
              var note = " Note: this can happen occasionally, ignore.";
              Assert.IsTrue(_updateErrorCount > 0, "Expected some update errors." + note);
              Assert.IsTrue(_sumErrorCount > 0, "Expected some sum errors." + note);
              */
        }