public void WhenCreatingContractsAlertWithReferencePropertiesThenKeyValuePropertiesAreConvertedCorrectly()
        {
            ContractsAlert contractsAlert = CreateContractsAlert <TestAlertWithReferenceProperties>();

            Assert.AreEqual(3, contractsAlert.AlertProperties.Count);

            int propertyIndex = 1;

            Assert.AreEqual("KeyValueReference", contractsAlert.AlertProperties[propertyIndex].PropertyName);
            Assert.AreEqual(AlertPropertyType.KeyValue, contractsAlert.AlertProperties[propertyIndex].Type);
            Assert.AreEqual("KeyValueReferenceDisplayName", ((KeyValueReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex]).DisplayName);
            Assert.AreEqual(0, ((KeyValueReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex]).Order);
            Assert.AreEqual("keyValueReferencePath", ((KeyValueReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex]).ReferencePath);
            Assert.AreEqual(false, ((KeyValueReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex]).ShowHeaders);

            propertyIndex++;
            Assert.AreEqual("KeyValueWithHeadersReference", contractsAlert.AlertProperties[propertyIndex].PropertyName);
            Assert.AreEqual(AlertPropertyType.KeyValue, contractsAlert.AlertProperties[propertyIndex].Type);
            Assert.AreEqual("KeyValueWithHeadersReferenceDisplayName", ((KeyValueReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex]).DisplayName);
            Assert.AreEqual(1, ((KeyValueReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex]).Order);
            Assert.AreEqual("keyValueWithHeadersReferencePath", ((KeyValueReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex]).ReferencePath);
            Assert.AreEqual(true, ((KeyValueReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex]).ShowHeaders);
            Assert.AreEqual("Keys", ((KeyValueReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex]).KeyHeaderName);
            Assert.AreEqual("Values2", ((KeyValueReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex]).ValueHeaderName);
        }
예제 #2
0
        public void WhenCreatingContractsAlertThenMetricChartPropertiesAreConvertedCorrectly()
        {
            ContractsAlert contractsAlert = CreateContractsAlert <TestAlert>();

            Assert.AreEqual(1, contractsAlert.AlertProperties.Count);

            MetricChartAlertProperty alertProperty = (MetricChartAlertProperty)contractsAlert.AlertProperties[0];

            Assert.AreEqual(string.Empty, alertProperty.ResourceId);
            Assert.AreEqual("someMetric", alertProperty.MetricName);
            Assert.AreEqual("namespace", alertProperty.MetricNamespace);
            Assert.AreEqual(2, alertProperty.MetricDimensions.Count);
            Assert.AreEqual("val1", alertProperty.MetricDimensions["dim1"]);
            Assert.AreEqual("val2", alertProperty.MetricDimensions["dim2"]);
            Assert.AreEqual(new DateTime(1972, 6, 6), alertProperty.StartTimeUtc);
            Assert.AreEqual(new DateTime(1972, 6, 7), alertProperty.EndTimeUtc);
            Assert.AreEqual(TimeSpan.FromHours(1), alertProperty.TimeGrain);
            Assert.AreEqual(ContractsAggregationType.Average, alertProperty.AggregationType);
            Assert.AreEqual(ContractsThresholdType.LessThan, alertProperty.ThresholdType);
            Assert.AreEqual(0.1, alertProperty.StaticThreshold.LowerThreshold);
            Assert.AreEqual(0.5, alertProperty.StaticThreshold.UpperThreshold);
            Assert.AreEqual((uint)5, alertProperty.DynamicThreshold.FailingPeriodsSettings.ConsecutivePeriods);
            Assert.AreEqual((uint)3, alertProperty.DynamicThreshold.FailingPeriodsSettings.ConsecutiveViolations);
            Assert.AreEqual(DynamicThreshold.MediumSensitivity, alertProperty.DynamicThreshold.Sensitivity);
            Assert.AreEqual(new DateTime(1972, 6, 6), alertProperty.DynamicThreshold.IgnoreDataBefore);
        }
예제 #3
0
        public void WhenCreatingContractsAlertWithMismatchListTableThenExceptionIsThrown()
        {
            var alert = new TestAlert();

            alert.SingleColumnTable.Add(2);
            ContractsAlert contractsAlert = alert.CreateContractsAlert(AnalysisRequest, "detector", false, false);
        }
예제 #4
0
        public void WhenCreatingContractsAlertThenChartPropertiesAreConvertedCorrectly()
        {
            ContractsAlert contractsAlert = CreateContractsAlert <TestAlert>();

            Assert.AreEqual(2, contractsAlert.AlertProperties.Count);

            int propertyIndex = 0;
            ChartReferenceAlertProperty chartReferenceAlertProperty = (ChartReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex];

            Assert.AreEqual("ChartReference", chartReferenceAlertProperty.PropertyName);
            Assert.AreEqual(AlertPropertyType.Chart, chartReferenceAlertProperty.Type);
            Assert.AreEqual("ChartReferenceDisplayName", chartReferenceAlertProperty.DisplayName);
            Assert.AreEqual(0, chartReferenceAlertProperty.Order);
            Assert.AreEqual(ContractsChartType.BarChart, chartReferenceAlertProperty.ChartType);
            Assert.AreEqual(ContractsChartAxisType.String, chartReferenceAlertProperty.XAxisType);
            Assert.AreEqual(ContractsChartAxisType.Percentage, chartReferenceAlertProperty.YAxisType);
            Assert.AreEqual("chartReferencePath", chartReferenceAlertProperty.ReferencePath);

            propertyIndex++;
            ChartAlertProperty chartAlertProperty = (ChartAlertProperty)contractsAlert.AlertProperties[propertyIndex];

            Assert.AreEqual("DataPoints", chartAlertProperty.PropertyName);
            Assert.AreEqual(AlertPropertyType.Chart, chartAlertProperty.Type);
            Assert.AreEqual("ChartDisplayName", chartAlertProperty.DisplayName);
            Assert.AreEqual(1, chartAlertProperty.Order);
            Assert.AreEqual(ContractsChartType.LineChart, chartAlertProperty.ChartType);
            Assert.AreEqual(ContractsChartAxisType.Date, chartAlertProperty.XAxisType);
            Assert.AreEqual(ContractsChartAxisType.Number, chartAlertProperty.YAxisType);
            Assert.AreEqual(1, chartAlertProperty.DataPoints.Count);
            Assert.AreEqual(new DateTime(2018, 7, 9, 14, 31, 0, DateTimeKind.Utc), chartAlertProperty.DataPoints[0].X);
            Assert.AreEqual(5, chartAlertProperty.DataPoints[0].Y);
        }
예제 #5
0
        public void WhenCreatingContractsAlertThenTablePropertiesAreConvertedCorrectly()
        {
            ContractsAlert contractsAlert = CreateContractsAlert <TestAlert>();

            Assert.AreEqual(2, contractsAlert.AlertProperties.Count);

            int propertyIndex = 0;
            TableAlertProperty <string> singleColumnTableAlertProperty = (TableAlertProperty <string>)contractsAlert.AlertProperties[propertyIndex];

            Assert.AreEqual("SingleColumnTable", singleColumnTableAlertProperty.PropertyName);
            Assert.AreEqual(AlertPropertyType.Table, singleColumnTableAlertProperty.Type);
            Assert.AreEqual("SingleColumnTableDisplayName", singleColumnTableAlertProperty.DisplayName);
            Assert.AreEqual(0, singleColumnTableAlertProperty.Order);
            Assert.AreEqual(false, singleColumnTableAlertProperty.ShowHeaders);

            Assert.AreEqual(3, singleColumnTableAlertProperty.Values.Count);
            Assert.AreEqual("value1", singleColumnTableAlertProperty.Values[0]);
            Assert.AreEqual("value2", singleColumnTableAlertProperty.Values[1]);
            Assert.AreEqual("value3", singleColumnTableAlertProperty.Values[2]);

            Assert.AreEqual(0, singleColumnTableAlertProperty.Columns.Count);

            propertyIndex++;
            TableAlertProperty <Dictionary <string, string> > multiColumnTableAlertProperty = (TableAlertProperty <Dictionary <string, string> >)contractsAlert.AlertProperties[propertyIndex];

            Assert.AreEqual("Table", multiColumnTableAlertProperty.PropertyName);
            Assert.AreEqual(AlertPropertyType.Table, multiColumnTableAlertProperty.Type);
            Assert.AreEqual("TableDisplayName", multiColumnTableAlertProperty.DisplayName);
            Assert.AreEqual(1, multiColumnTableAlertProperty.Order);
            Assert.AreEqual(true, multiColumnTableAlertProperty.ShowHeaders);

            Assert.AreEqual(2, multiColumnTableAlertProperty.Values.Count);
            Assert.AreEqual(4, multiColumnTableAlertProperty.Values[0].Count);
            Assert.AreEqual("p11", multiColumnTableAlertProperty.Values[0]["Prop1"]);
            Assert.AreEqual("The value of Prop2 is p21", multiColumnTableAlertProperty.Values[0]["Prop2"]);
            Assert.AreEqual("p31", multiColumnTableAlertProperty.Values[0]["Prop3"]);
            Assert.AreEqual("<a href=\"http://microsoft.com/\">Link for NDP1</a>", multiColumnTableAlertProperty.Values[0]["UriProp"]);

            Assert.AreEqual(4, multiColumnTableAlertProperty.Values[1].Count);
            Assert.AreEqual("p12", multiColumnTableAlertProperty.Values[1]["Prop1"]);
            Assert.AreEqual("The value of Prop2 is p22", multiColumnTableAlertProperty.Values[1]["Prop2"]);
            Assert.AreEqual("p32", multiColumnTableAlertProperty.Values[1]["Prop3"]);
            Assert.AreEqual("<a href=\"http://contoso.com/\">Link for NDP2</a>", multiColumnTableAlertProperty.Values[1]["UriProp"]);

            Assert.AreEqual(4, multiColumnTableAlertProperty.Columns.Count);
            Assert.AreEqual("Prop1", multiColumnTableAlertProperty.Columns[0].PropertyName);
            Assert.AreEqual("First Prop", multiColumnTableAlertProperty.Columns[0].DisplayName);
            Assert.AreEqual("Prop2", multiColumnTableAlertProperty.Columns[1].PropertyName);
            Assert.AreEqual("Second Prop", multiColumnTableAlertProperty.Columns[1].DisplayName);
            Assert.AreEqual("UriProp", multiColumnTableAlertProperty.Columns[2].PropertyName);
            Assert.AreEqual("Uri Prop", multiColumnTableAlertProperty.Columns[2].DisplayName);
            Assert.AreEqual("Prop3", multiColumnTableAlertProperty.Columns[3].PropertyName);
            Assert.AreEqual("Third Prop, without order", multiColumnTableAlertProperty.Columns[3].DisplayName);
        }
        public void WhenCreatingContractsAlertThenArmRequestPropertiesAreConvertedCorrectly()
        {
            ContractsAlert contractsAlert = CreateContractsAlert <TestAlert>();

            Assert.AreEqual(1, contractsAlert.AlertProperties.Count);

            AzureResourceManagerRequestAlertProperty armAlertProperty = (AzureResourceManagerRequestAlertProperty)contractsAlert.AlertProperties[0];

            Assert.AreEqual("ArmRequest", armAlertProperty.PropertyName);
            Assert.AreEqual(AlertPropertyType.AzureResourceManagerRequest, armAlertProperty.Type);
            Assert.AreEqual(true, armAlertProperty.IsOptional);
            Assert.AreEqual("/some/query/path", armAlertProperty.AzureResourceManagerRequestUri.ToString());
            Assert.AreEqual(6, armAlertProperty.PropertiesToDisplay.Count);

            int propertyIndex = 0;

            Assert.AreEqual("TextReference", armAlertProperty.PropertiesToDisplay[propertyIndex].PropertyName);
            Assert.AreEqual("Text Reference Display Name", armAlertProperty.PropertiesToDisplay[propertyIndex].DisplayName);
            Assert.AreEqual(AlertPropertyType.Text, armAlertProperty.PropertiesToDisplay[propertyIndex].Type);

            propertyIndex++;
            Assert.AreEqual("LongTextReference", armAlertProperty.PropertiesToDisplay[propertyIndex].PropertyName);
            Assert.AreEqual(AlertPropertyType.LongText, armAlertProperty.PropertiesToDisplay[propertyIndex].Type);

            propertyIndex++;
            Assert.AreEqual("KeyValueReference", armAlertProperty.PropertiesToDisplay[propertyIndex].PropertyName);
            Assert.AreEqual(AlertPropertyType.KeyValue, armAlertProperty.PropertiesToDisplay[propertyIndex].Type);

            propertyIndex++;
            Assert.AreEqual("ChartReference", armAlertProperty.PropertiesToDisplay[propertyIndex].PropertyName);
            Assert.AreEqual(AlertPropertyType.Chart, armAlertProperty.PropertiesToDisplay[propertyIndex].Type);

            propertyIndex++;
            Assert.AreEqual("MultiColumnTableReference", armAlertProperty.PropertiesToDisplay[propertyIndex].PropertyName);
            Assert.AreEqual(AlertPropertyType.Table, armAlertProperty.PropertiesToDisplay[propertyIndex].Type);
            var tableReferenceAlertProperty = armAlertProperty.PropertiesToDisplay[propertyIndex] as TableReferenceAlertProperty;

            Assert.IsNotNull(tableReferenceAlertProperty);
            Assert.AreEqual(true, tableReferenceAlertProperty.IsOptional);
            Assert.AreEqual(true, tableReferenceAlertProperty.IsPropertySerialized);

            propertyIndex++;
            Assert.AreEqual("SingleColumnTableReference", armAlertProperty.PropertiesToDisplay[propertyIndex].PropertyName);
            Assert.AreEqual(AlertPropertyType.Table, armAlertProperty.PropertiesToDisplay[propertyIndex].Type);
        }
        public void WhenCreatingContractsAlertThenListPropertiesAreConvertedCorrectly()
        {
            ContractsAlert contractsAlert = CreateContractsAlert <TestAlert>();

            Assert.AreEqual(11, contractsAlert.AlertProperties.Count);

            int propertyIndex = 0;

            this.VerifyRawAlertProperty(contractsAlert.AlertProperties[propertyIndex++], "AdditionalData_0_RawProperty", "raw");
            this.VerifyTextAlertProperty(contractsAlert.AlertProperties[propertyIndex++], "AdditionalData_0_Name1", "First name title", 0, "First name");
            this.VerifyTextAlertProperty(contractsAlert.AlertProperties[propertyIndex++], "AdditionalData_0_Uri1", "First link", 1, "<a href=\"https://xkcd.com/\" target=\"_blank\">Link to data 1</a>");
            this.VerifyTextAlertProperty(contractsAlert.AlertProperties[propertyIndex++], "AdditionalData_1_Name2", "Second name title", 2, "Second name");
            this.VerifyTextAlertProperty(contractsAlert.AlertProperties[propertyIndex++], "AdditionalData_1_Uri2", "Second link", 3, "<a href=\"https://darwinawards.com/\" target=\"_blank\">Link to data 2</a>");
            this.VerifyRawAlertProperty(contractsAlert.AlertProperties[propertyIndex++], "AdditionalData_1_MoreData_0_RawProperty", "raw");
            this.VerifyTextAlertProperty(contractsAlert.AlertProperties[propertyIndex++], "AdditionalData_1_MoreData_0_Name1", "First name title", 4, "First name");
            this.VerifyTextAlertProperty(contractsAlert.AlertProperties[propertyIndex++], "AdditionalData_1_MoreData_0_Uri1", "First link", 5, "<a href=\"https://xkcd.com/\" target=\"_blank\">Link to data 1</a>");
            this.VerifyRawAlertProperty(contractsAlert.AlertProperties[propertyIndex++], "AdditionalData_1_MoreData_1_RawProperty", "raw");
            this.VerifyTextAlertProperty(contractsAlert.AlertProperties[propertyIndex++], "AdditionalData_1_MoreData_1_Name1", "First name title", 6, "First name");
            this.VerifyTextAlertProperty(contractsAlert.AlertProperties[propertyIndex++], "AdditionalData_1_MoreData_1_Uri1", "First link", 7, "<a href=\"https://xkcd.com/\" target=\"_blank\">Link to data 1</a>");
        }
        public void WhenCreatingContractsAlertThenTextPropertiesAreConvertedCorrectly()
        {
            ContractsAlert contractsAlert = CreateContractsAlert <TestAlertBasic>();

            Assert.AreEqual(2, contractsAlert.AlertProperties.Count);

            int propertyIndex = 0;

            Assert.AreEqual("LongTextValue", contractsAlert.AlertProperties[propertyIndex].PropertyName);
            Assert.AreEqual(AlertPropertyType.LongText, contractsAlert.AlertProperties[propertyIndex].Type);
            Assert.AreEqual("LongTextDisplayName", ((LongTextAlertProperty)contractsAlert.AlertProperties[propertyIndex]).DisplayName);
            Assert.AreEqual(0, ((LongTextAlertProperty)contractsAlert.AlertProperties[propertyIndex]).Order);
            Assert.AreEqual("LongTextValue", ((LongTextAlertProperty)contractsAlert.AlertProperties[propertyIndex]).Value);

            propertyIndex++;
            Assert.AreEqual("TextValue", contractsAlert.AlertProperties[propertyIndex].PropertyName);
            Assert.AreEqual(AlertPropertyType.Text, contractsAlert.AlertProperties[propertyIndex].Type);
            Assert.AreEqual("TextDisplayName", ((TextAlertProperty)contractsAlert.AlertProperties[propertyIndex]).DisplayName);
            Assert.AreEqual(1, ((TextAlertProperty)contractsAlert.AlertProperties[propertyIndex]).Order);
            Assert.AreEqual("TextValue", ((TextAlertProperty)contractsAlert.AlertProperties[propertyIndex]).Value);
        }
        public void WhenCreatingContractsAlertWithFormatStringThenTextPropertiesAreConvertedCorrectly()
        {
            ContractsAlert contractsAlert = CreateContractsAlert <TestAlertWithFormatString>();

            Assert.AreEqual(2, contractsAlert.AlertProperties.Count);

            int propertyIndex = 0;

            Assert.AreEqual("DateTimeValue", contractsAlert.AlertProperties[propertyIndex].PropertyName);
            Assert.AreEqual(AlertPropertyType.Text, contractsAlert.AlertProperties[propertyIndex].Type);
            Assert.AreEqual("DateTimeDisplayName", ((TextAlertProperty)contractsAlert.AlertProperties[propertyIndex]).DisplayName);
            Assert.AreEqual(0, ((TextAlertProperty)contractsAlert.AlertProperties[propertyIndex]).Order);
            Assert.AreEqual("The time is: 2019-03-07 11", ((TextAlertProperty)contractsAlert.AlertProperties[propertyIndex]).Value);

            propertyIndex++;
            Assert.AreEqual("DoubleValue", contractsAlert.AlertProperties[propertyIndex].PropertyName);
            Assert.AreEqual(AlertPropertyType.LongText, contractsAlert.AlertProperties[propertyIndex].Type);
            Assert.AreEqual("DoubleDisplayName", ((LongTextAlertProperty)contractsAlert.AlertProperties[propertyIndex]).DisplayName);
            Assert.AreEqual(1, ((LongTextAlertProperty)contractsAlert.AlertProperties[propertyIndex]).Order);
            Assert.AreEqual("The area of the unit circle is 3, or 3.141593 to be exact", ((LongTextAlertProperty)contractsAlert.AlertProperties[propertyIndex]).Value);
        }
        public void WhenCreatingContractsAlertWithReferencePropertiesThenTextPropertiesAreConvertedCorrectly()
        {
            ContractsAlert contractsAlert = CreateContractsAlert <TestAlertWithReferenceProperties>();

            Assert.AreEqual(2, contractsAlert.AlertProperties.Count);

            int propertyIndex = 0;

            Assert.AreEqual("LongTextReference", contractsAlert.AlertProperties[propertyIndex].PropertyName);
            Assert.AreEqual(AlertPropertyType.LongText, contractsAlert.AlertProperties[propertyIndex].Type);
            Assert.AreEqual("LongTextReferenceDisplayName", ((LongTextReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex]).DisplayName);
            Assert.AreEqual(0, ((LongTextReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex]).Order);
            Assert.AreEqual("longTextReferencePath", ((LongTextReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex]).ReferencePath);

            propertyIndex++;
            Assert.AreEqual("TextReference", contractsAlert.AlertProperties[propertyIndex].PropertyName);
            Assert.AreEqual(AlertPropertyType.Text, contractsAlert.AlertProperties[propertyIndex].Type);
            Assert.AreEqual("TextReferenceDisplayName", ((TextReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex]).DisplayName);
            Assert.AreEqual(1, ((TextReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex]).Order);
            Assert.AreEqual("textReferencePath", ((TextReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex]).ReferencePath);
        }
        public void WhenCreatingContractsAlertWithUriFormattingThenTextPropertiesAreConvertedCorrectly()
        {
            ContractsAlert contractsAlert = CreateContractsAlert <TestAlertWithUri>();

            Assert.AreEqual(3, contractsAlert.AlertProperties.Count);

            int propertyIndex = 1;

            Assert.AreEqual("LongUrlValue", contractsAlert.AlertProperties[propertyIndex].PropertyName);
            Assert.AreEqual(AlertPropertyType.LongText, contractsAlert.AlertProperties[propertyIndex].Type);
            Assert.AreEqual("LongUrlDisplayName", ((LongTextAlertProperty)contractsAlert.AlertProperties[propertyIndex]).DisplayName);
            Assert.AreEqual(0, ((LongTextAlertProperty)contractsAlert.AlertProperties[propertyIndex]).Order);
            Assert.AreEqual("<a href=\"https://www.bing.com/\">LinkText Link text</a>", ((LongTextAlertProperty)contractsAlert.AlertProperties[propertyIndex]).Value);

            propertyIndex++;
            Assert.AreEqual("UrlValue", contractsAlert.AlertProperties[propertyIndex].PropertyName);
            Assert.AreEqual(AlertPropertyType.Text, contractsAlert.AlertProperties[propertyIndex].Type);
            Assert.AreEqual("UrlDisplayName", ((TextAlertProperty)contractsAlert.AlertProperties[propertyIndex]).DisplayName);
            Assert.AreEqual(1, ((TextAlertProperty)contractsAlert.AlertProperties[propertyIndex]).Order);
            Assert.AreEqual("<a href=\"https://www.microsoft.com/\">LinkText Link text</a>", ((TextAlertProperty)contractsAlert.AlertProperties[propertyIndex]).Value);
        }
예제 #12
0
        public void WhenCreatingContractsAlertWithReferencePropertiesThenTablePropertiesAreConvertedCorrectly()
        {
            ContractsAlert contractsAlert = CreateContractsAlert <TestAlertWithReferenceProperties>();

            Assert.AreEqual(2, contractsAlert.AlertProperties.Count);

            int propertyIndex = 0;
            TableReferenceAlertProperty multiColumnTableAlertProperty = (TableReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex];

            Assert.AreEqual("MultiColumnTableReference", multiColumnTableAlertProperty.PropertyName);
            Assert.AreEqual(AlertPropertyType.Table, multiColumnTableAlertProperty.Type);
            Assert.AreEqual("MultiColumnTableReferenceDisplayName", multiColumnTableAlertProperty.DisplayName);
            Assert.AreEqual(0, multiColumnTableAlertProperty.Order);
            Assert.AreEqual(true, multiColumnTableAlertProperty.ShowHeaders);
            Assert.AreEqual("multiColumnTableReferencePath", multiColumnTableAlertProperty.ReferencePath);

            Assert.AreEqual(4, multiColumnTableAlertProperty.Columns.Count);
            Assert.AreEqual("Prop1", multiColumnTableAlertProperty.Columns[0].PropertyName);
            Assert.AreEqual("First Prop", multiColumnTableAlertProperty.Columns[0].DisplayName);
            Assert.AreEqual("Prop2", multiColumnTableAlertProperty.Columns[1].PropertyName);
            Assert.AreEqual("Second Prop", multiColumnTableAlertProperty.Columns[1].DisplayName);
            Assert.AreEqual("UriProp", multiColumnTableAlertProperty.Columns[2].PropertyName);
            Assert.AreEqual("Uri Prop", multiColumnTableAlertProperty.Columns[2].DisplayName);
            Assert.AreEqual("Prop3", multiColumnTableAlertProperty.Columns[3].PropertyName);
            Assert.AreEqual("Third Prop, without order", multiColumnTableAlertProperty.Columns[3].DisplayName);

            propertyIndex++;
            TableReferenceAlertProperty singleColumnTableAlertProperty = (TableReferenceAlertProperty)contractsAlert.AlertProperties[propertyIndex];

            Assert.AreEqual("SingleColumnTableReference", singleColumnTableAlertProperty.PropertyName);
            Assert.AreEqual(AlertPropertyType.Table, singleColumnTableAlertProperty.Type);
            Assert.AreEqual("SingleColumnTableReferenceDisplayName", singleColumnTableAlertProperty.DisplayName);
            Assert.AreEqual(1, singleColumnTableAlertProperty.Order);
            Assert.AreEqual(false, singleColumnTableAlertProperty.ShowHeaders);
            Assert.AreEqual("singleColumnTableReference", singleColumnTableAlertProperty.ReferencePath);
            Assert.AreEqual(0, singleColumnTableAlertProperty.Columns.Count);
        }
 public void WhenCreatingContractsAlertWithInvalidArmRequestThenExceptionIsThrown()
 {
     ContractsAlert contractsAlert = CreateContractsAlert <TestAlertWithInvalidArmRequest>();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EmulationAlert"/> class
 /// </summary>
 /// <param name="contractsAlert">The alert presentation object</param>
 /// <param name="emulationIterationDate">The timestamp of the emulation iteration</param>
 public EmulationAlert(ContractsAlert contractsAlert, DateTime emulationIterationDate)
 {
     this.ContractsAlert         = contractsAlert;
     this.ResourceIdentifier     = ResourceIdentifier.CreateFromResourceId(contractsAlert.ResourceId);
     this.EmulationIterationDate = emulationIterationDate;
 }
 public void WhenCreatingContractsAlertWithInvalidKeyValuePropertyThenExceptionIsThrown()
 {
     ContractsAlert contractsAlert = CreateContractsAlert <TestAlertWithInvalidKeyValueProperty>();
 }
 public void WhenCreatingContractsAlertWithReferenceLongTextPropertyAndFormatStringThenExceptionIsThrown()
 {
     ContractsAlert contractsAlert = CreateContractsAlert <TestAlertWithReferenceLongTextAndFormatString>();
 }
예제 #17
0
 public void WhenCreatingContractsAlertWithReferencePropertiesAndInvalidColumnsThenExceptionIsThrown()
 {
     ContractsAlert contractsAlert = CreateContractsAlert <TestAlertWithReferencePropertiesAndNotReferenceTableData>();
 }
예제 #18
0
 public void WhenCreatingContractsAlertWithNotGenericReferencePropertiesThenExceptionIsThrown()
 {
     ContractsAlert contractsAlert = CreateContractsAlert <TestAlertWithNotGenericReferenceProperties>();
 }
예제 #19
0
 public void WhenCreatingContractsAlertWithNonListTableThenExceptionIsThrown()
 {
     ContractsAlert contractsAlert = CreateContractsAlert <TestAlertOnNotList>();
 }
 public void WhenCreatingContractsAlertWithUriFormattingOnRelativeUriPropertyThenExceptionIsThrown()
 {
     ContractsAlert contractsAlert = CreateContractsAlert <TestAlertWithRelativeUri>();
 }