System.Data.SQLite
Check-in [f4e1038098]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add unit testing support for the fix to ticket [ccfa69fc32].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-ccfa69fc32
Files: files | file ages | folders
SHA1: f4e10380987de81096f0a5952930bfdbe3befece
User & Date: mistachkin 2011-09-11 15:33:10
References
2011-09-12
20:41 Ticket [ccfa69fc32] Transaction on conflict behave status still Closed with 1 other change artifact: 99569dc0ad user: mistachkin
20:24 Ticket [ccfa69fc32]: 1 change artifact: 3e7fe221da user: mistachkin
2011-09-11
15:37 Ticket [ccfa69fc32]: 2 changes artifact: 5683d82b91 user: mistachkin
15:36 Ticket [ccfa69fc32]: 1 change artifact: 17072e76a4 user: mistachkin
Context
2011-09-11
15:45
Fix test cleanup to remove the 'add' variable. check-in: 538c5ca711 user: mistachkin tags: bug-ccfa69fc32
15:33
Add unit testing support for the fix to ticket [ccfa69fc32]. check-in: f4e1038098 user: mistachkin tags: bug-ccfa69fc32
14:33
Experimental fix for ticket [ccfa69fc32]. check-in: 42af4d17a5 user: mistachkin tags: bug-ccfa69fc32
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Added Tests/tkt-ccfa69fc32.eagle.







































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
###############################################################################
#
# tkt-ccfa69fc32.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require EagleLibrary
package require EagleTest

runTestPrologue

###############################################################################

source [file join $path common.eagle]
runSQLiteTestPrologue

###############################################################################

#
# NOTE: Setup the variables that refer to the various files required by the
#       tests in this file.
#
set testLinqExeFile [getBuildFileName testlinq.exe]
set northwindEfDbFile [file nativename [file join [file dirname $path] \
    testlinq northwindEF.db]]

#
# NOTE: Setup the test constraints specific to the tests in this file.
#
if {![haveConstraint file_[file tail $testLinqExeFile]]} then {
  checkForFile $test_channel $testLinqExeFile
}

if {![haveConstraint file_[file tail $northwindEfDbFile]]} then {
  checkForFile $test_channel $northwindEfDbFile
}

###############################################################################

runTest {test tkt-ccfa69fc32-1.1 {Entity Framework / Transaction Scope} -body {
  set result [list]

  foreach add [list false true false] {
    set code [catch {
      testExec $testLinqExeFile [list -eventflags Wait -directory \
      [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
      -success 0] -efTransaction $add
    } error]

    tlog "---- BEGIN STDOUT OUTPUT\n"
    tlog $output
    tlog "\n---- END STDOUT OUTPUT\n"

    lappend result $code

    if {$code == 0} then {
      lappend result [string trim $output]
    } else {
      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  unset -nocomplain code output error result pageSize
} -constraints {eagle file_testlinq.exe file_northwindEF.db} -match glob \
-result {0 {} 0 {System.Data.UpdateException: * --->\
System.Data.SQLite.SQLiteException: Abort due to constraint violation
PRIMARY KEY must be unique
*} 0 {1 2 3 4 5 6 7 8 9 10}}}

###############################################################################

unset -nocomplain testLinqExeFile northwindEfDbFile

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Changes to testlinq/Program.cs.

210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
...
283
284
285
286
287
288
289

290
291
292
293
294
295
296
297
...
302
303
304
305
306
307
308

309
310
311
312
313
314
315
          {
              using (northwindEFEntities db = new northwindEFEntities())
              {
                  using (TransactionScope scope = new TransactionScope())
                  {
                      //
                      // NOTE: *REQUIRED* This is required so that the
                      //       framework is prevented from using multiple
                      //       connections to the underlying SQLite database
                      //       (i.e. which would result in multiple IMMEDIATE
                      //       transactions, thereby failing [later on] with
                      //       locking errors).
                      //
                      db.Connection.Open();

                      for (int index = 0; index < 5; index++)
                      {
                          int id = (index % 10) + 1;

................................................................................
                      {
                          scope.Complete();
                          db.AcceptAllChanges();
                      }
                  }
              }
          }


          using (northwindEFEntities db = new northwindEFEntities())
          {
              bool once = false;
              var query = from t in db.Territories
                          where t.TerritoryID.CompareTo(11) < 0
                          orderby t.TerritoryID
                          select t;
................................................................................
                      Console.Write(' ');

                  Console.Write(territories.TerritoryID);

                  once = true;
              }
          }


          return 0;
      }

    private static int OldTests()
    {
      using (northwindEFEntities db = new northwindEFEntities())







|
|
|
|
|







 







>
|







 







>







210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
...
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
...
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
          {
              using (northwindEFEntities db = new northwindEFEntities())
              {
                  using (TransactionScope scope = new TransactionScope())
                  {
                      //
                      // NOTE: *REQUIRED* This is required so that the
                      //       Entity Framework is prevented from opening
                      //       multiple connections to the underlying SQLite
                      //       database (i.e. which would result in multiple
                      //       IMMEDIATE transactions, thereby failing [later
                      //       on] with locking errors).
                      //
                      db.Connection.Open();

                      for (int index = 0; index < 5; index++)
                      {
                          int id = (index % 10) + 1;

................................................................................
                      {
                          scope.Complete();
                          db.AcceptAllChanges();
                      }
                  }
              }
          }
          else
          {
              using (northwindEFEntities db = new northwindEFEntities())
              {
                  bool once = false;
                  var query = from t in db.Territories
                              where t.TerritoryID.CompareTo(11) < 0
                              orderby t.TerritoryID
                              select t;
................................................................................
                          Console.Write(' ');

                      Console.Write(territories.TerritoryID);

                      once = true;
                  }
              }
          }

          return 0;
      }

    private static int OldTests()
    {
      using (northwindEFEntities db = new northwindEFEntities())