public static void LogEvent(ATMEvent e) { if (_events.Count < 1024) // Avoid unconstrained memory growth { _events.Add(e); } }
public void Setup() { _event = null; _velocity = NSubstitute.Substitute.For <iCalculateVelocity>(); _uut = new CalculateCourse(_velocity); _uut.CourseCalculated += (o, args) => { _event = args; }; }
public void Setup() { _event = null; _decoder = NSubstitute.Substitute.For <iTranspondanceDecoder>(); _uut = new TrafficDataSorter(_decoder); _uut.DataSorted += (o, args) => { _event = args; }; }
public async Task ProcessEventsAsync(PartitionContext context, IEnumerable <EventData> messages) { foreach (EventData eventData in messages) { string data = Encoding.UTF8.GetString(eventData.GetBytes()); Debug.WriteLine(string.Format("Message received. Partition: '{0}', Data: '{1}'", context.Lease.PartitionId, data)); // Log the event ATMEvent e = JsonConvert.DeserializeObject <ATMEvent>(data); ATMEventAggregator.LogEvent(e); } if (this.checkpointStopWatch.Elapsed > TimeSpan.FromMinutes(5)) { await context.CheckpointAsync(); this.checkpointStopWatch.Restart(); } }