Skip to content

Commit

Permalink
More culture and cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
Evangelink committed Jun 23, 2022
1 parent cef4125 commit ef0d664
Show file tree
Hide file tree
Showing 15 changed files with 11 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
case "TestCase.CodeFilePath":
testCase.CodeFilePath = propertyData; break;
case "TestCase.LineNumber":
testCase.LineNumber = int.Parse(propertyData!); break;
testCase.LineNumber = int.Parse(propertyData!, CultureInfo.CurrentCulture); break;
default:
// No need to register member properties as they get registered as part of TestCaseProperties class.
testProperty = TestProperty.Register(testProperty.Id, testProperty.Label, testProperty.GetValueType(), testProperty.Attributes, typeof(TestObject));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
case "TestResult.Outcome":
testResult.Outcome = (TestOutcome)Enum.Parse(typeof(TestOutcome), propertyData!); break;
case "TestResult.Duration":
testResult.Duration = TimeSpan.Parse(propertyData!); break;
testResult.Duration = TimeSpan.Parse(propertyData!, CultureInfo.CurrentCulture); break;
case "TestResult.StartTime":
testResult.StartTime = DateTimeOffset.Parse(propertyData!); break;
testResult.StartTime = DateTimeOffset.Parse(propertyData!, CultureInfo.CurrentCulture); break;
case "TestResult.EndTime":
testResult.EndTime = DateTimeOffset.Parse(propertyData!); break;
testResult.EndTime = DateTimeOffset.Parse(propertyData!, CultureInfo.CurrentCulture); break;
case "TestResult.ErrorMessage":
testResult.ErrorMessage = propertyData; break;
case "TestResult.ErrorStackTrace":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Collections.Generic;
using System.Globalization;

namespace Microsoft.VisualStudio.TestPlatform.CoreUtilities.Helpers;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ private bool TryToRunInStaThread(Action action, bool waitForCompletion)
EqtTrace.Warning("BaseRunTests.TryToRunInSTAThread: Failed to run in STA thread: {0}", ex);
TestRunEventsHandler.HandleLogMessage(
TestMessageLevel.Warning,
string.Format(CultureInfo.CurrentCulture, CrossPlatEngineResources.ExecutionThreadApartmentStateNotSupportedForFramework, _runConfiguration.TargetFramework.ToString()));
string.Format(CultureInfo.CurrentCulture, CrossPlatEngineResources.ExecutionThreadApartmentStateNotSupportedForFramework, _runConfiguration.TargetFramework!.ToString()));
}

return success;
Expand Down
7 changes: 5 additions & 2 deletions src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

Expand Down Expand Up @@ -674,7 +673,11 @@ private static void WarnAboutNotFoundRuntimeProvidersOrThrowWhenNoneAreFound(Lis
{
stringBuilder.Append(Resources.Resources.SkippingSource).Append(' ');
}
stringBuilder.AppendLine($"{detail.Source} ({detail.Framework}, {detail.Architecture})");
stringBuilder.AppendLine(
#if NET6_0_OR_GREATER
System.Globalization.CultureInfo.InvariantCulture,
#endif
$"{detail.Source} ({detail.Framework}, {detail.Architecture})");
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;

using Microsoft.TestPlatform.Extensions.TrxLogger.Utility;
using Microsoft.TestPlatform.Extensions.TrxLogger.XML;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;

using Microsoft.VisualStudio.TestPlatform.Extensions.TrxLogger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Runtime.InteropServices;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;

using Microsoft.VisualStudio.TestPlatform.ObjectModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Globalization;

using Microsoft.VisualStudio.TestPlatform.ObjectModel;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.IO;
using System.Security;
Expand Down
2 changes: 0 additions & 2 deletions src/vstest.console/Processors/RunTestsArgumentProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;

using Microsoft.VisualStudio.TestPlatform.Client.RequestHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void SetupChannelShouldCreateTimestampedLogFileForHost()
It.IsAny<IEnumerable<string>>(),
It.IsAny<Dictionary<string, string?>>(),
It.Is<TestRunnerConnectionInfo>(
t => t.LogFile.Contains("log.host." + DateTime.Now.ToString("yy-MM-dd", CultureInfo.CurrentCulture))
t => t.LogFile!.Contains("log.host." + DateTime.Now.ToString("yy-MM-dd", CultureInfo.CurrentCulture))
&& t.LogFile.Contains("_" + Environment.CurrentManagedThreadId + ".txt"))));
#if NETFRAMEWORK
EqtTrace.TraceLevel = TraceLevel.Off;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Threading;
Expand Down

0 comments on commit ef0d664

Please sign in to comment.