public void AlertCondition_Roundtrips() { // Arrange JObject data = EmbeddedResource.ReadAsJObject("Microsoft.AspNet.WebHooks.Messages.AlertMessage1.json"); AzureAlertCondition expected = new AzureAlertCondition { MetricName = "CPU percentage", MetricUnit = "Count", MetricValue = "2.716631", Threshold = "10", WindowSize = "5", TimeAggregation = "Average", Operator = "LessThan", }; // Act AzureAlertCondition actual = data["context"]["condition"].ToObject<AzureAlertCondition>(); // Assert string expectedJson = JsonConvert.SerializeObject(expected, _serializerSettings); string actualJson = JsonConvert.SerializeObject(actual, _serializerSettings); Assert.Equal(expectedJson, actualJson); }
public void AlertCondition_Roundtrips() { // Arrange JObject data = EmbeddedResource.ReadAsJObject("Microsoft.AspNet.WebHooks.Messages.AlertMessage1.json"); AzureAlertCondition expected = new AzureAlertCondition { MetricName = "CPU percentage", MetricUnit = "Count", MetricValue = "2.716631", Threshold = "10", WindowSize = "5", TimeAggregation = "Average", Operator = "LessThan", }; // Act AzureAlertCondition actual = data["context"]["condition"].ToObject <AzureAlertCondition>(); // Assert string expectedJson = JsonConvert.SerializeObject(expected, _serializerSettings); string actualJson = JsonConvert.SerializeObject(actual, _serializerSettings); Assert.Equal(expectedJson, actualJson); }