Пример #1
0
        public void GetChangeNumberWhenNotSetOrRedisThrowsException()
        {
            //Arrange
            var changeNumber     = -1;
            var redisAdapterMock = new Mock <IRedisAdapter>();

            redisAdapterMock.Setup(x => x.Get(splitsKeyPrefix + "till")).Returns("");
            var splitCache = new RedisSplitCache(redisAdapterMock.Object);

            //Act
            var result = splitCache.GetChangeNumber();

            //Assert
            Assert.AreEqual(changeNumber, result);
        }
Пример #2
0
        public void GetChangeNumberWhenNotSetOrRedisThrowsException()
        {
            //Arrange
            var changeNumber = -1;

            _redisAdapterMock
            .Setup(x => x.Get(splitsKeyPrefix + "till"))
            .Returns(string.Empty);

            //Act
            var result = _redisSplitCache.GetChangeNumber();

            //Assert
            Assert.AreEqual(changeNumber, result);
        }
Пример #3
0
        public void SetAndGetChangeNumberTest()
        {
            //Arrange
            var changeNumber     = 1234;
            var redisAdapterMock = new Mock <IRedisAdapter>();

            redisAdapterMock.Setup(x => x.Set(splitsKeyPrefix + "till", changeNumber.ToString())).Returns(true);
            redisAdapterMock.Setup(x => x.Get(splitsKeyPrefix + "till")).Returns(changeNumber.ToString());
            var splitCache = new RedisSplitCache(redisAdapterMock.Object);

            //Act
            splitCache.SetChangeNumber(changeNumber);
            var result = splitCache.GetChangeNumber();

            //Assert
            Assert.AreEqual(changeNumber, result);
        }