/// <summary> /// Compares properties of expected and response /// </summary> private static void CompareRecommendedActionProperties(RecommendedAction expected, RecommendedAction response, string expectedState = null) { Assert.Equal(expected.Properties.RecommendationReason, response.Properties.RecommendationReason); Assert.Equal(expected.Properties.ValidSince, response.Properties.ValidSince); Assert.Equal(expected.Properties.LastRefresh, response.Properties.LastRefresh); Assert.Equal(expected.Properties.State.ActionInitiatedBy, response.Properties.State.ActionInitiatedBy); Assert.Equal(expectedState ?? expected.Properties.State.CurrentValue, response.Properties.State.CurrentValue); Assert.Equal(expected.Properties.State.LastModified, response.Properties.State.LastModified); Assert.Equal(expected.Properties.IsExecutableAction, response.Properties.IsExecutableAction); Assert.Equal(expected.Properties.IsRevertableAction, response.Properties.IsRevertableAction); Assert.Equal(expected.Properties.IsArchivedAction, response.Properties.IsArchivedAction); Assert.Equal(expected.Properties.ExecuteActionStartTime, response.Properties.ExecuteActionStartTime); Assert.Equal(expected.Properties.ExecuteActionDuration, response.Properties.ExecuteActionDuration); Assert.Equal(expected.Properties.RevertActionStartTime, response.Properties.RevertActionStartTime); Assert.Equal(expected.Properties.RevertActionDuration, response.Properties.RevertActionDuration); Assert.Equal(expected.Properties.ExecuteActionInitiatedBy, response.Properties.ExecuteActionInitiatedBy); Assert.Equal(expected.Properties.ExecuteActionInitiatedTime, response.Properties.ExecuteActionInitiatedTime); Assert.Equal(expected.Properties.RevertActionInitiatedBy, response.Properties.RevertActionInitiatedBy); Assert.Equal(expected.Properties.RevertActionInitiatedTime, response.Properties.RevertActionInitiatedTime); Assert.Equal(expected.Properties.Score, response.Properties.Score); CompareRecommendedActionImplementationInfo(expected.Properties.ImplementationDetails, response.Properties.ImplementationDetails); CompareRecommendedActionErrorInfo(expected.Properties.ErrorDetails, response.Properties.ErrorDetails); CompareRecommendedActionImpactInfo(expected.Properties.EstimatedImpact, response.Properties.EstimatedImpact); CompareRecommendedActionImpactInfo(expected.Properties.ObservedImpact, response.Properties.ObservedImpact); CompareRecommendedActionMetricInfo(expected.Properties.TimeSeries, response.Properties.TimeSeries); CompareRecommendedActionLinkedObjects(expected.Properties.LinkedObjects, response.Properties.LinkedObjects); CompareRecommendedActionDetails(expected.Properties.Details, response.Properties.Details); }
/// <summary> /// Validates single recommended action object /// </summary> private static void ValidateSingleRecommendedAction(RecommendedAction response, string expectedResponseType, string expectedState = null) { Assert.NotNull(response); RecommendedAction expected = CreateRecommendedActionListForValidation().SingleOrDefault(a => a.Name.Equals(response.Name)); Assert.NotNull(expected); Assert.Equal(expectedResponseType, response.Type); CompareRecommendedActionProperties(expected, response, expectedState); }