// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. #nullable disable using NuGet.Protocol.Core.Types; using NuGet.Test.Utility; namespace NuGet.Protocol.Test { /// /// This is a test source cache context that should be used in places where it is not convenient to dispose the /// . Since must be called /// before does anything meaningful, this implementation disables that /// property. /// public sealed class TestSourceCacheContext : SourceCacheContext { private TestDirectory _testDirectory; public override string GeneratedTempFolder { get { if (_testDirectory == null) { _testDirectory = TestDirectory.Create(); } return _testDirectory; } } protected override void Dispose(bool disposing) { _testDirectory?.Dispose(); base.Dispose(disposing); } } }