public async Task AuditorPerfStatisticsTest() { var auditorPerf = new AuditorPerfStatistics { BatchInfos = new List <Models.BatchSavedInfo>(), QuantaPerSecond = 1, QuantaQueueLength = 2, UpdateDate = DateTime.UtcNow.Ticks }; var envelope = auditorPerf.CreateEnvelope(); envelope.Sign(TestEnvironment.Auditor1KeyPair); var auditorConnection = new AlphaWebSocketConnection(context, new FakeWebSocket(), "127.0.0.1") { ClientPubKey = TestEnvironment.Auditor1KeyPair }; using var writer = new XdrBufferWriter(); var inMessage = envelope.ToIncomingMessage(writer); await AssertMessageHandling(auditorConnection, inMessage, null); }
public static AuditorPerformanceStatistics FromModel(this AuditorPerfStatistics statistics, string auditor) { if (statistics == null) { throw new ArgumentNullException(nameof(statistics)); } return(new AuditorPerformanceStatistics { Auditor = auditor, QuantaPerSecond = statistics.QuantaPerSecond, QuantaQueueLength = statistics.QuantaQueueLength, BatchInfos = statistics.BatchInfos.Select(b => b.FromModel()).ToList(), UpdateDate = new DateTime(statistics.UpdateDate, DateTimeKind.Utc) }); }
public void AddAuditorStatistics(string accountId, AuditorPerfStatistics message) { lock (auditorsStatistics) auditorsStatistics[accountId] = message.FromModel(accountId); }