コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }