diff --git a/Common/Api/LiveAlgorithmResultsJsonConverter.cs b/Common/Api/LiveAlgorithmResultsJsonConverter.cs index 206a757ecc2f..6369adcde9ee 100644 --- a/Common/Api/LiveAlgorithmResultsJsonConverter.cs +++ b/Common/Api/LiveAlgorithmResultsJsonConverter.cs @@ -90,7 +90,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist Datacenter = jObject.Value("datacenter"), Public = jObject.Value("public"), Success = jObject.Value("success"), - Errors = jObject["errors"]?.ToObject>() + Errors = jObject["errors"]?.ToObject>() ?? new List() }; if (!liveAlgoResults.Success) diff --git a/Tests/Api/LiveAlgorithmResultsJsonConverterTests.cs b/Tests/Api/LiveAlgorithmResultsJsonConverterTests.cs index 49be26842b0e..39b79f209b6e 100644 --- a/Tests/Api/LiveAlgorithmResultsJsonConverterTests.cs +++ b/Tests/Api/LiveAlgorithmResultsJsonConverterTests.cs @@ -65,7 +65,7 @@ public void EveryFieldIsOptional() Assert.IsFalse(result.Success); Assert.IsNull(result.Status); Assert.IsNull(result.DeployId); - Assert.IsNull(result.Errors); + CollectionAssert.IsEmpty(result.Errors, "Like every other response, a missing errors array reads as no errors"); Assert.IsNull(result.Stopped); Assert.AreEqual(default(DateTime), result.Launched); Assert.IsNull(result.Charts); diff --git a/Tests/Api/ProjectTests.cs b/Tests/Api/ProjectTests.cs index 472c519c17fe..bd04dcd2fa10 100644 --- a/Tests/Api/ProjectTests.cs +++ b/Tests/Api/ProjectTests.cs @@ -930,11 +930,12 @@ public void CreatesLiveAlgorithm() Assert.IsTrue(readLiveLogs.Length >= 0, "The length of the logs was negative!"); Assert.IsTrue(readLiveLogs.DeploymentOffset >= 0, "The deploymentOffset"); } - catch (Exception ex) + catch { - // Delete the project in case of an error + // Stop whatever is running and delete the project in case of an error + ApiClient.LiquidateLiveAlgorithm(projectId); Assert.IsTrue(ApiClient.DeleteProject(projectId).Success); - throw ex; + throw; } // Delete the project