Beispiel #1
0
 public TwinCountingReportMetadata(
     string testDescription,
     string expectedSource,
     string actualSource,
     TestReportType testReportType,
     TwinTestPropertyType twinTestPropertyType)
     : base(testDescription, expectedSource, actualSource, TestOperationResultType.Twin, testReportType, false)
 {
     this.TwinTestPropertyType = twinTestPropertyType;
 }
Beispiel #2
0
        internal static List <ITestReportMetadata> ParseReportMetadataJson(string reportMetadataListJson, ILogger logger)
        {
            var reportMetadataList = new List <ITestReportMetadata>();

            try
            {
                JObject reportMetadatas = JObject.Parse(reportMetadataListJson);

                foreach (JToken metadata in reportMetadatas.Children())
                {
                    TestReportType testReportType = GetEnumValueFromReportMetadata <TestReportType>(metadata, "TestReportType");

                    switch (testReportType)
                    {
                    case TestReportType.CountingReport:
                        reportMetadataList.Add(JsonConvert.DeserializeObject <CountingReportMetadata>(((JProperty)metadata).Value.ToString()));
                        break;

                    case TestReportType.TwinCountingReport:
                        reportMetadataList.Add(JsonConvert.DeserializeObject <TwinCountingReportMetadata>(((JProperty)metadata).Value.ToString()));
                        break;

                    case TestReportType.DeploymentTestReport:
                        reportMetadataList.Add(JsonConvert.DeserializeObject <DeploymentTestReportMetadata>(((JProperty)metadata).Value.ToString()));
                        break;

                    case TestReportType.DirectMethodReport:
                        reportMetadataList.Add(JsonConvert.DeserializeObject <DirectMethodReportMetadata>(((JProperty)metadata).Value.ToString()));
                        break;

                    case TestReportType.NetworkControllerReport:
                        reportMetadataList.Add(JsonConvert.DeserializeObject <NetworkControllerReportMetadata>(((JProperty)metadata).Value.ToString()));
                        break;

                    case TestReportType.ErrorReport:
                        reportMetadataList.Add(new ErrorReportMetadata());
                        break;

                    case TestReportType.TestInfoReport:
                        reportMetadataList.Add(new TestInfoReportMetadata());
                        break;

                    default:
                        throw new NotImplementedException("{testReportType} doesn't implement to construct report metadata from Twin.");
                    }
                }
            }
            catch (Exception ex)
            {
                logger.LogError(ex, $"Incorrect parsing for report metadata list: {reportMetadataListJson}{Environment.NewLine}");
                throw;
            }

            return(reportMetadataList);
        }
 public CountingReportMetadata(
     string testDescription,
     string expectedSource,
     string actualSource,
     TestOperationResultType testOperationResultType,
     TestReportType testReportType)
     : base(testDescription)
 {
     this.ExpectedSource          = Preconditions.CheckNonWhiteSpace(expectedSource, nameof(expectedSource));
     this.ActualSource            = Preconditions.CheckNonWhiteSpace(actualSource, nameof(actualSource));
     this.TestOperationResultType = testOperationResultType;
     this.TestReportType          = testReportType;
 }
Beispiel #4
0
 internal EdgeHubRestartDirectMethodReportGenerator(
     string trackingId,
     string senderSource,
     string receiverSource,
     TestReportType testReportType,
     ITestResultCollection <TestOperationResult> senderTestResults,
     ITestResultCollection <TestOperationResult> receiverTestResults)
 {
     this.TrackingId               = Preconditions.CheckNonWhiteSpace(trackingId, nameof(trackingId));
     this.SenderSource             = Preconditions.CheckNonWhiteSpace(senderSource, nameof(senderSource));
     this.ReceiverSource           = Preconditions.CheckNonWhiteSpace(receiverSource, nameof(receiverSource));
     this.TestReportType           = testReportType;
     this.SenderTestResults        = Preconditions.CheckNotNull(senderTestResults, nameof(senderTestResults));
     this.ReceiverTestResults      = Preconditions.CheckNotNull(receiverTestResults, nameof(receiverTestResults));
     this.completedStatusHistogram = new Dictionary <HttpStatusCode, List <TimeSpan> >();
 }
Beispiel #5
0
 public DirectMethodReportMetadata(string expectedSource, string actualSource, TestReportType testReportType, TimeSpan tolerancePeriod)
 {
     this.ExpectedSource  = expectedSource;
     this.ActualSource    = actualSource;
     this.TestReportType  = testReportType;
     this.TolerancePeriod = tolerancePeriod;
 }
 public DirectMethodReportMetadata(string expectedSource, string actualSource, TestReportType testReportType, TimeSpan tolerancePeriod)
 {
     this.ExpectedSource  = Preconditions.CheckNonWhiteSpace(expectedSource, nameof(expectedSource));
     this.ActualSource    = Preconditions.CheckNonWhiteSpace(actualSource, nameof(actualSource));
     this.TestReportType  = testReportType;
     this.TolerancePeriod = tolerancePeriod;
 }
 public CountingReportMetadata(string expectedSource, string actualSource, TestOperationResultType testOperationResultType, TestReportType testReportType)
 {
     this.ExpectedSource          = expectedSource;
     this.ActualSource            = actualSource;
     this.TestOperationResultType = testOperationResultType;
     this.TestReportType          = testReportType;
 }