Ejemplo n.º 1
0
        public void FlushHitsAsyncTest()
        {
            var hitCache  = new Mock <IHitCacheImplementation>();
            var visitorId = visitorDelegate.VisitorId;

            visitorDelegate.Config.HitCacheImplementation = hitCache.Object;

            var defaultStrategy = new DefaultStrategy(visitorDelegate);

            defaultStrategy.FlushHitAsync();

            hitCache.Verify(x => x.FlushHits(visitorId), Times.Once());

            var error = new Exception("hitsCache error");

            hitCache.Setup(x => x.FlushHits(It.IsAny <string>())).Throws(error);

            defaultStrategy.FlushHitAsync();

            fsLogManagerMock.Verify(x => x.Error(error.Message, "FlushHits"), Times.Once());
        }