public void ThenTheResponseShouldBe(DocString json) { // We deliberately serialize to formatted JSON because if the test fails it's easier to see the actual vs expected which comparing JObjects doesn't give us. var expectedJObject = JsonConvert.DeserializeObject <JObject>(json.Content); var actualJObject = JObject.FromObject(PostRequestHandler.CurrentResponse); ObjectComparer.RoundAllDoubleProperties(actualJObject, roundingPrecision: 8); ObjectComparer.RoundAllDoubleProperties(expectedJObject, roundingPrecision: 8); ObjectComparer.AssertAreEqual(actualResultObj: actualJObject, expectedResultObj: expectedJObject); }
public void ThenTheFirstSavedMachineDetailShouldMatchResultFromTheMachineResultRepo(string resultName) { if (firstDotMachineStatus.MachineStatuses.Length < 1) { Assert.True(false, $"Unable to get machine status {firstDotMachineStatus}"); } var actualObj = JObject.FromObject(firstDotMachineStatus); var expectedObj = JObject.FromObject(machineStatusGetter.ResponseRepo[resultName]); ObjectComparer.RoundAllDoubleProperties(actualObj, roundingPrecision: 8); ObjectComparer.RoundAllDoubleProperties(expectedObj, roundingPrecision: 8); ObjectComparer.AssertAreEqual(actualResultObj: actualObj, expectedResultObj: expectedObj); }