mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
some bug fixes in pref tests
This commit is contained in:
@@ -7,6 +7,6 @@ namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Utility
|
||||
{
|
||||
public class TestResult
|
||||
{
|
||||
public string ElapsedTime { get; set; }
|
||||
public double ElapsedTime { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,19 @@ namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Utility
|
||||
/// </summary>
|
||||
public class TestTimer
|
||||
{
|
||||
private static string ResultFolder = Environment.GetEnvironmentVariable("ResultFolder");
|
||||
private static string resultFolder = InitResultFolder();
|
||||
|
||||
|
||||
private static string InitResultFolder()
|
||||
{
|
||||
string resultFodler = Environment.GetEnvironmentVariable("ResultFolder");
|
||||
if (string.IsNullOrEmpty(resultFodler))
|
||||
{
|
||||
string assemblyLocation = System.Reflection.Assembly.GetEntryAssembly().Location;
|
||||
resultFodler = Path.GetDirectoryName(assemblyLocation);
|
||||
}
|
||||
return resultFodler;
|
||||
}
|
||||
|
||||
public TestTimer()
|
||||
{
|
||||
@@ -38,10 +50,11 @@ namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Utility
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Test Name: {0} Run time in milliSeconds: {1}", testName, TotalMilliSeconds));
|
||||
Console.ForegroundColor = currentColor;
|
||||
string resultContent = Newtonsoft.Json.JsonConvert.SerializeObject(new TestResult { ElapsedTime = TotalMilliSeconds.ToString() });
|
||||
string resultContent = Newtonsoft.Json.JsonConvert.SerializeObject(new TestResult { ElapsedTime = TotalMilliSeconds });
|
||||
string fileName = testName + ".json";
|
||||
string resultFilePath = string.IsNullOrEmpty(ResultFolder) ? fileName : Path.Combine(ResultFolder, fileName);
|
||||
string resultFilePath = string.IsNullOrEmpty(resultFolder) ? fileName : Path.Combine(resultFolder, fileName);
|
||||
File.WriteAllText(resultFilePath, resultContent);
|
||||
Console.WriteLine("Result file: " + resultFilePath);
|
||||
}
|
||||
|
||||
public double TotalMilliSeconds
|
||||
|
||||
Reference in New Issue
Block a user