Example #1
0
 public void CleanupRemovesCurrent()
 {
     using (var transformation = new FakeTransformation())
     {
         TransformationContext.Initialize(transformation, transformation.GenerationEnvironment);
         TransformationContext.Cleanup();
         var value = TransformationContext.Current;
     }
 }
Example #2
0
 public void Dispose()
 {
     if (this.transformation != null)
     {
         TransformationContext.Cleanup();
         this.transformation.Dispose();
         this.transformation = null;
     }
 }
Example #3
0
 public void InitializeSetsCurrent()
 {
     using (var transformation = new FakeTransformation())
     {
         TransformationContext.Initialize(transformation, transformation.GenerationEnvironment);
         try
         {
             Assert.IsNotNull(TransformationContext.Current);
         }
         finally
         {
             TransformationContext.Cleanup();
         }
     }
 }
Example #4
0
        public void CleanupDisposesCurrent()
        {
            using (var transformation = new FakeTransformation())
            {
                bool disposed = false;
                TransformationContext.Initialize(transformation, transformation.GenerationEnvironment);
                try
                {
                    TransformationContext.Current.Disposed += delegate { disposed = true; };
                }
                finally
                {
                    TransformationContext.Cleanup();
                }

                Assert.IsTrue(disposed);
            }
        }
Example #5
0
 public void CleanupDoesNotThrowExceptionsWhenContextIsNullBecauseTheyWouldObscureInitializationExceptions()
 {
     TransformationContext.Cleanup();
 }
Example #6
0
 public void Dispose()
 {
     TransformationContext.Cleanup();
     this.transformation.Dispose();
 }