@@ -34,6 +34,51 @@ public void CleanUp()
3434 _memoryStore . Reset ( ) ;
3535 }
3636
37+ [ TestMethod ]
38+ public void TestDobleCommit ( )
39+ {
40+ var key1 = new byte [ ] { 0x05 , 0x02 } ;
41+ var value1 = new byte [ ] { 0x06 , 0x04 } ;
42+
43+ var snapshot = ( MemorySnapshot ) _memoryStore . GetSnapshot ( ) ;
44+ Assert . AreEqual ( 0 , snapshot . WriteBatchLength ) ;
45+
46+ snapshot . Put ( key1 , value1 ) ;
47+ Assert . AreEqual ( 1 , snapshot . WriteBatchLength ) ;
48+
49+ snapshot . Delete ( key1 ) ;
50+ Assert . AreEqual ( 1 , snapshot . WriteBatchLength ) ;
51+ snapshot . Commit ( ) ;
52+
53+ Assert . AreEqual ( 0 , snapshot . WriteBatchLength ) ;
54+ }
55+
56+ [ TestMethod ]
57+ public void TestDobleCommitTwo ( )
58+ {
59+ var key1 = new byte [ ] { 0x51 , 0x02 } ;
60+ var value1 = new byte [ ] { 0x06 , 0x04 } ;
61+
62+ var snapshotA = ( MemorySnapshot ) _memoryStore . GetSnapshot ( ) ;
63+ var snapshotB = ( MemorySnapshot ) _memoryStore . GetSnapshot ( ) ;
64+
65+ Assert . IsFalse ( _memoryStore . Contains ( key1 ) ) ;
66+ snapshotA . Put ( key1 , value1 ) ;
67+ snapshotA . Commit ( ) ;
68+ Assert . IsTrue ( _memoryStore . Contains ( key1 ) ) ;
69+
70+ snapshotB . Delete ( key1 ) ;
71+ snapshotB . Commit ( ) ;
72+ Assert . IsFalse ( _memoryStore . Contains ( key1 ) ) ;
73+
74+ snapshotA . Put ( key1 , value1 ) ;
75+ snapshotA . Commit ( ) ;
76+ Assert . IsTrue ( _memoryStore . Contains ( key1 ) ) ;
77+
78+ snapshotB . Commit ( ) ; // Already committed
79+ Assert . IsTrue ( _memoryStore . Contains ( key1 ) ) ; // It fails before #3953
80+ }
81+
3782 [ TestMethod ]
3883 public void SingleSnapshotTest ( )
3984 {
0 commit comments