From 3ca98373f44b7eb283578947d19aeb96c2fbb388 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Wed, 11 May 2016 15:19:56 -0700 Subject: [PATCH] Fix JSON serialization --- .../Source/RunTests/Cache/WebDataStorage.cs | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/Tools/Source/RunTests/Cache/WebDataStorage.cs b/src/Tools/Source/RunTests/Cache/WebDataStorage.cs index 88b6d2a4a29df..6353bbbefbcb9 100644 --- a/src/Tools/Source/RunTests/Cache/WebDataStorage.cs +++ b/src/Tools/Source/RunTests/Cache/WebDataStorage.cs @@ -15,16 +15,15 @@ namespace RunTests.Cache { internal sealed class WebDataStorage : IDataStorage { - private const string NameExitCode = "ExitCode"; - private const string NameOutputStandard = "OutputStandard"; - private const string NameOutputError = "OutputError"; - private const string NameResultsFileName = "ResultsFileName"; - private const string NameResultsFileContent = "ResultsFileContent"; - private const string NameElapsedSeconds = "ElapsedSeconds"; - private const string NameElapsedSecondsMisspelled = "EllapsedSeconds"; - private const string NameTestPassed = "TestPassed"; - private const string NameTestFailed = "TestFailed"; - private const string NameTestSkipped = "TestSkipped"; + private const string NameExitCode = "exitCode"; + private const string NameOutputStandard = "outputStandard"; + private const string NameOutputError = "outputError"; + private const string NameResultsFileName = "resultsFileName"; + private const string NameResultsFileContent = "resultsFileContent"; + private const string NameElapsedSeconds = "elapsedSeconds"; + private const string NameTestPassed = "testPassed"; + private const string NameTestFailed = "testFailed"; + private const string NameTestSkipped = "testSkipped"; private readonly RestClient _restClient = new RestClient(Constants.DashboardUriString); @@ -77,17 +76,12 @@ public async Task AddCachedTestResult(AssemblyInfo assemblyInfo, ContentFile con } var obj = JObject.Parse(response.Content); - - // During the transition from ellapsed to elapsed the client needs to accept either - // value from the json object. - var elapsedProperty = obj.Property(NameElapsedSeconds) ?? obj.Property(NameElapsedSecondsMisspelled); - var result = new CachedTestResult( exitCode: obj.Value(NameExitCode), standardOutput: obj.Value(NameOutputStandard), errorOutput: obj.Value(NameOutputError), resultsFileContent: obj.Value(NameResultsFileContent), - elapsed: TimeSpan.FromSeconds(elapsedProperty.Value.Value())); + elapsed: TimeSpan.FromSeconds(obj.Value(NameElapsedSeconds))); return result; } catch (Exception ex) @@ -107,7 +101,6 @@ private static JObject CreateTestResultData(string resultsFileName, CachedTestRe obj[NameResultsFileName] = resultsFileName; obj[NameResultsFileContent] = testResult.ResultsFileContent; obj[NameElapsedSeconds] = (int)testResult.Elapsed.TotalSeconds; - obj[NameElapsedSecondsMisspelled] = (int)testResult.Elapsed.TotalSeconds; obj[NameTestPassed] = numbers.Item1; obj[NameTestFailed] = numbers.Item2; obj[NameTestSkipped] = numbers.Item3;