public void CanAddStreamInit()
        {
            var      store     = new DiagnosticStoreImpl();
            DateTime timestamp = DateTime.Now;

            store.AddStreamInit(timestamp, TimeSpan.FromMilliseconds(200.0), true);
            DiagnosticEvent periodicEvent = store.CreateEventAndReset();

            LdValue streamInits = periodicEvent.JsonValue.Get("streamInits");

            Assert.Equal(1, streamInits.Count);

            LdValue streamInit = streamInits.Get(0);

            Assert.Equal(UnixMillisecondTime.FromDateTime(timestamp).Value, streamInit.Get("timestamp").AsLong);
            Assert.Equal(200, streamInit.Get("durationMillis").AsInt);
            Assert.True(streamInit.Get("failed").AsBool);
        }
        public void CreatingEventResetsFields()
        {
            var store = new DiagnosticStoreImpl();

            store.IncrementDroppedEvents();
            store.IncrementDeduplicatedUsers();
            store.RecordEventsInBatch(10);
            store.AddStreamInit(DateTime.Now, TimeSpan.FromMilliseconds(200.0), true);
            LdValue firstPeriodicEvent = store.CreateEventAndReset().JsonValue;
            LdValue nextPeriodicEvent  = store.CreateEventAndReset().JsonValue;

            Assert.Equal(firstPeriodicEvent.Get("creationDate"), nextPeriodicEvent.Get("dataSinceDate"));
            Assert.Equal(0, nextPeriodicEvent.Get("eventsInLastBatch").AsInt);
            Assert.Equal(0, nextPeriodicEvent.Get("droppedEvents").AsInt);
            Assert.Equal(0, nextPeriodicEvent.Get("deduplicatedUsers").AsInt);
            Assert.Equal(0, nextPeriodicEvent.Get("eventsInLastBatch").AsInt);
            LdValue streamInits = nextPeriodicEvent.Get("streamInits");

            Assert.Equal(0, streamInits.Count);
        }