Exemplo n.º 1
0
        private void AssertAlertsAreSame(Alert expected, Alert found)
        {
            if (expected == null)
            {
                Assert.Null(found);
            }
            else
            {
                Assert.True(InfrastructureInsightsCommon.ResourceAreSame(expected, found));
                Assert.Equal(expected.AlertId, found.AlertId);

                if (expected.AlertProperties == null)
                {
                    Assert.Null(found.AlertProperties);
                }
                else
                {
                    Assert.Equal(expected.AlertProperties.Count, found.AlertProperties.Count);
                }

                Assert.Equal(expected.ClosedByUserAlias, found.ClosedByUserAlias);
                Assert.Equal(expected.ClosedTimestamp, found.ClosedTimestamp);
                Assert.Equal(expected.CreatedTimestamp, found.CreatedTimestamp);

                if (expected.Description == null)
                {
                    Assert.Null(found.Description);
                }
                else
                {
                    Assert.Equal(expected.Description.Count, found.Description.Count);
                }

                Assert.Equal(expected.FaultId, found.FaultId);
                Assert.Equal(expected.FaultTypeId, found.FaultTypeId);
                Assert.Equal(expected.ImpactedResourceDisplayName, found.ImpactedResourceDisplayName);
                Assert.Equal(expected.ImpactedResourceId, found.ImpactedResourceId);
                Assert.Equal(expected.LastUpdatedTimestamp, found.LastUpdatedTimestamp);

                if (expected.Remediation == null)
                {
                    Assert.Null(found.Remediation);
                }
                else
                {
                    Assert.Equal(expected.Remediation.Count, found.Remediation.Count);
                }

                Assert.Equal(expected.ResourceProviderRegistrationId, found.ResourceProviderRegistrationId);
                Assert.Equal(expected.ResourceRegistrationId, found.ResourceRegistrationId);
                Assert.Equal(expected.Severity, found.Severity);
                Assert.Equal(expected.State, found.State);
                Assert.Equal(expected.Title, found.Title);
            }
        }
 private void AssertServiceHealthsEqual(ServiceHealth expected, ServiceHealth found)
 {
     if (expected == null)
     {
         Assert.Null(found);
     }
     else
     {
         Assert.True(InfrastructureInsightsCommon.ResourceAreSame(expected, found));
     }
 }
Exemplo n.º 3
0
        private void AssertRegionHealthsAreSame(RegionHealth expected, RegionHealth found)
        {
            if (expected == null)
            {
                Assert.Null(found);
            }
            else
            {
                Assert.True(InfrastructureInsightsCommon.ResourceAreSame(expected, found));
                Assert.Equal(expected.AlertSummary.CriticalAlertCount, found.AlertSummary.CriticalAlertCount);
                Assert.Equal(expected.AlertSummary.WarningAlertCount, found.AlertSummary.WarningAlertCount);

                Assert.Equal(expected.UsageMetrics.Count, found.UsageMetrics.Count);
            }
        }
        private void AssertAreSameValidateResourceHealths(ResourceHealth expected, ResourceHealth found)
        {
            if (expected == null)
            {
                Assert.Null(found);
            }
            else
            {
                Assert.True(InfrastructureInsightsCommon.ResourceAreSame(expected, found));
                if (expected.AlertSummary == null)
                {
                    Assert.Null(found.AlertSummary);
                }
                else
                {
                    Assert.NotNull(found.AlertSummary);
                    Assert.Equal(expected.AlertSummary.CriticalAlertCount, found.AlertSummary.CriticalAlertCount);
                    Assert.Equal(expected.AlertSummary.WarningAlertCount, found.AlertSummary.WarningAlertCount);
                }

                Assert.Equal(found.HealthState, expected.HealthState);
                Assert.Equal(found.NamespaceProperty, expected.NamespaceProperty);
                Assert.Equal(found.RegistrationId, expected.RegistrationId);
                Assert.Equal(found.RoutePrefix, expected.RoutePrefix);

                Assert.Equal(found.ResourceDisplayName, expected.ResourceDisplayName);
                Assert.Equal(found.ResourceLocation, expected.ResourceLocation);
                Assert.Equal(found.ResourceName, expected.ResourceName);
                Assert.Equal(found.ResourceType, expected.ResourceType);
                Assert.Equal(found.ResourceURI, expected.ResourceURI);
                Assert.Equal(found.RpRegistrationId, expected.RpRegistrationId);

                if (found.UsageMetrics == null)
                {
                    Assert.Null(found.UsageMetrics);
                }
                else
                {
                    Assert.NotNull(found.UsageMetrics);
                    Assert.Equal(found.UsageMetrics.Count, expected.UsageMetrics.Count);
                }
            }
        }