Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }