Exemple #1
0
        public void UponDispose_Unwinds()
        {
            TransactionScopeForTest sut;

            using (sut = new TransactionScopeForTest()) {
                Assert.That(sut.IsUnwound, Is.False);
            }
            Assert.That(sut.IsUnwound, Is.True);
        }
Exemple #2
0
 public void UponDispose_RemovesItemFromAmbientContextStack()
 {
     using (var ctx1 = new TransactionScopeForTest()) {
         using (var ctx2 = new TransactionScopeForTest()) {
             Assert.That(TransactionScope.Depth, Is.EqualTo(2));
         }
         Assert.That(TransactionScope.Depth, Is.EqualTo(1));
     }
     Assert.That(TransactionScope.Depth, Is.Zero);
 }
Exemple #3
0
        public void UponDispose_DoesNotUnwindIfSpecified()
        {
            TransactionScopeForTest sut;

            using (sut = new TransactionScopeForTest()) {
                sut.ShouldUnwind = false;
                Assert.That(sut.IsUnwound, Is.False);
            }
            Assert.That(sut.IsUnwound, Is.False);
        }
Exemple #4
0
 public void UponCreation_AddsItemToAmbientContextStack()
 {
     Assert.That(TransactionScope.Depth, Is.Zero);
     using (var ctx1 = new TransactionScopeForTest()) {
         Assert.That(TransactionScope.Depth, Is.EqualTo(1));
         using (var ctx2 = new TransactionScopeForTest()) {
             Assert.That(TransactionScope.Depth, Is.EqualTo(2));
             Assert.That(TransactionScope.Current, Is.EqualTo(ctx2));
         }
     }
 }
Exemple #5
0
 public void UponCreation_SetsAmbientContext()
 {
     using (var ctx = new TransactionScopeForTest()) {
         Assert.That(TransactionScope.Current, Is.EqualTo(ctx));
     }
 }