コード例 #1
0
        public void Start_ShouldNotSendImpressionsCount()
        {
            // Arrange.
            var impressionsCounter     = new ImpressionsCounter();
            var impressionsCountSender = new ImpressionsCountSender(_apiClient.Object, impressionsCounter, 1);

            // Act.
            impressionsCountSender.Start();

            // Assert.
            Thread.Sleep(1500);
            _apiClient.Verify(mock => mock.SendBulkImpressionsCount(It.IsAny <ConcurrentDictionary <KeyCache, int> >()), Times.Never);
        }
コード例 #2
0
        public void Start_ShouldSendImpressionsCount()
        {
            // Arrange.
            var impressionsCounter = new ImpressionsCounter();

            impressionsCounter.Inc("feature1", SplitsHelper.MakeTimestamp(new DateTime(2020, 09, 02, 09, 15, 11, DateTimeKind.Utc)));
            impressionsCounter.Inc("feature1", SplitsHelper.MakeTimestamp(new DateTime(2020, 09, 02, 09, 50, 11, DateTimeKind.Utc)));
            impressionsCounter.Inc("feature2", SplitsHelper.MakeTimestamp(new DateTime(2020, 09, 02, 09, 50, 11, DateTimeKind.Utc)));
            impressionsCounter.Inc("feature3", SplitsHelper.MakeTimestamp(new DateTime(2020, 09, 02, 10, 50, 11, DateTimeKind.Utc)));

            var impressionsCountSender = new ImpressionsCountSender(_apiClient.Object, impressionsCounter, 1);

            // Act.
            impressionsCountSender.Start();

            // Assert.
            Thread.Sleep(1500);
            _apiClient.Verify(mock => mock.SendBulkImpressionsCount(It.IsAny <ConcurrentDictionary <KeyCache, int> >()), Times.Once);
        }