public void LogSuccessfullyAndSendImpressions() { //Act _treatmentLog.Start(); var impression = new KeyImpression() { keyName = "GetTreatment", feature = "test", treatment = "on", time = 7000, changeNumber = 1, label = "test-label" }; _treatmentLog.Log(impression); //Assert Thread.Sleep(2000); _apiClientMock.Verify(x => x.SendBulkImpressions(It.Is <List <KeyImpression> >(list => list.Count == 1))); }
public void LogSuccessfullyAndSendImpressions() { //Arrange var apiClientMock = new Mock <ITreatmentSdkApiClient>(); var queue = new BlockingQueue <KeyImpression>(10); var impressionsCache = new InMemoryImpressionsCache(queue); var treatmentLog = new SelfUpdatingTreatmentLog(apiClientMock.Object, 1, impressionsCache, 10); //Act treatmentLog.Start(); var impression = new KeyImpression() { keyName = "GetTreatment", feature = "test", treatment = "on", time = 7000, changeNumber = 1, label = "test-label" }; treatmentLog.Log(impression); //Assert Thread.Sleep(2000); apiClientMock.Verify(x => x.SendBulkImpressions(It.IsAny <string>())); }