From b387913d0e76aa7863f8766868cd2fb3b3fffcde Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 29 Nov 2017 22:11:32 -0800 Subject: Remove "Fixture" from the test assembly name --- .../Utility/Pushd.cs | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/test/WixToolsetTest.CoreIntegration/Utility/Pushd.cs (limited to 'src/test/WixToolsetTest.CoreIntegration/Utility/Pushd.cs') diff --git a/src/test/WixToolsetTest.CoreIntegration/Utility/Pushd.cs b/src/test/WixToolsetTest.CoreIntegration/Utility/Pushd.cs new file mode 100644 index 00000000..efd733a7 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/Utility/Pushd.cs @@ -0,0 +1,46 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolsetTest.CoreIntegration.Utility +{ + using System; + using System.IO; + + public class Pushd : IDisposable + { + protected bool Disposed { get; private set; } + + public Pushd(string path) + { + this.PreviousDirectory = Directory.GetCurrentDirectory(); + + Directory.SetCurrentDirectory(path); + } + + public string PreviousDirectory { get; } + + #region // IDisposable + + public void Dispose() + { + this.Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (this.Disposed) + { + return; + } + + if (disposing) + { + Directory.SetCurrentDirectory(this.PreviousDirectory); + } + + this.Disposed = true; + } + + #endregion + } +} -- cgit v1.2.3-55-g6feb