public static void ConfigureLearning(this TransportExtensions <LearningTransport> extensions) { var testRunId = TestContext.CurrentContext.Test.ID; string tempDir; if (Environment.OSVersion.Platform == PlatformID.Win32NT) { //can't use bin dir since that will be too long on the build agents tempDir = @"c:\temp"; } else { tempDir = Path.GetTempPath(); } var storageDir = Path.Combine(tempDir, testRunId); if (Directory.Exists(storageDir)) { Directory.Delete(storageDir, true); } extensions.StorageDirectory(storageDir); }
private static void TrySetSetStorageFolder(TransportExtensions <LearningTransport> settings) { // The learning transport requires a folder name, which defaults to the sln folder. When running on the build // agent there is no sln folder, so learning transport will throw an exception. A folder can be set using // the .StorageDirectory() extension so we'll set this from config. We won't know exactly what the folder // will be so instead we'll allow the config value to be formatted as $(EnvVariableName) so that we can // use a build agent variable to specify the folder. if (TryGetStorageFolder(out var storageFolder)) { storageFolder = Path.Combine(storageFolder, $".learningtransport.{Guid.NewGuid()}"); _log.Debug($"Using folder {storageFolder} for learning transport storage folder"); settings.StorageDirectory(storageFolder); } }
static void Configure(TransportExtensions <TestTransport> transportConfig, string brokerId) { var testRunId = TestContext.CurrentContext.Test.ID; string tempDir; if (Environment.OSVersion.Platform == PlatformID.Win32NT) { //can't use bin dir since that will be too long on the build agents tempDir = @"c:\temp"; } else { tempDir = Path.GetTempPath(); } var storageDir = Path.Combine(tempDir, testRunId, brokerId); transportConfig.StorageDirectory(storageDir); }