Пример #1
0
        public void serializeReportIntervalsTelemetryStatus()
        {
            ReportDescription reportDescription = new ReportDescription();

            reportDescription.addReport("specifierID", ReportName.TELEMETRY_STATUS, 0, DurationModifier.MINUTES);

            reportDescription.addIntervalResourceStatus("specifierID", DateTime.UtcNow, 0, DurationModifier.SECONDS, "rid", 1, (float)1.0, DataQuality.qualityGoodNonSpecific,
                                                        true, false, (float)1.0, (float)2.0, (float)3.0, (float)4.0, (float)5.0, (float)6.0, (float)7.0, (float)8.0, (float)9.0,
                                                        (float)10.0, (float)11.0, (float)12.0, (float)13.0, (float)14.0, (float)15.0, (float)16.0);

            oadrReportType report = reportDescription.generateReport("specifierID", DateTime.UtcNow);

            string output = SerializeOadrObject.serializeOjbect(report, typeof(oadrReportType));

            Assert.IsTrue(output.Contains("<oadrReportPayload"));
            Assert.IsTrue(output.Contains("<oadrPayloadResourceStatus"));
        }
Пример #2
0
        public void serializeReportIntervalsTelemetryUsage()
        {
            ReportDescription reportDescription = new ReportDescription();

            reportDescription.addReport("specifierID", ReportName.TELEMETRY_USAGE, 0, DurationModifier.MINUTES);

            int uid = reportDescription.addInterval("specifierID", DateTime.UtcNow, 0, DurationModifier.SECONDS);

            reportDescription.addIntervalReportPayload("specifierID", uid, "rid", 1, (float)1.0, (float)22.3, DataQuality.qualityGoodNonSpecific);
            reportDescription.addIntervalReportPayload("specifierID", uid, "rid2", 1, (float)1.0, (float)41.3, DataQuality.qualityGoodNonSpecific);

            reportDescription.addIntervalReportPayload("specifierID", DateTime.UtcNow.AddMinutes(5), 0, DurationModifier.SECONDS, "rid3", 1, (float)1.0, (float)57.6, DataQuality.qualityGoodNonSpecific);

            oadrReportType report = reportDescription.generateReport("specifierID", DateTime.UtcNow);

            // check that the createdDateTime is properly set to the current time
            Console.Out.WriteLine(DateTime.UtcNow - report.createdDateTime);
            Assert.IsTrue((DateTime.UtcNow - report.createdDateTime).Seconds < 5);

            string output = SerializeOadrObject.serializeOjbect(report, typeof(oadrReportType));

            Assert.IsTrue(output.Contains("<oadrReportPayload"));
            Assert.IsTrue(output.Contains("<payloadFloat"));
        }