public async Task CheckFailsWhenFreeMemoryIsBelowThreshold()
        {
            // Arrange
            var options = new RedisHasFreeMemory.Options
            {
                RedisFreeMemoryWarningThresholdInBytes = 1024
            };
            long maxMemory = options.RedisFreeMemoryWarningThresholdInBytes * 10;
            long usedMemory = maxMemory - options.RedisFreeMemoryWarningThresholdInBytes + 1;
            var redisMemoryUsageMock = new Mock<IRedisMemoryUsage>();
            redisMemoryUsageMock
                .Setup(x => x.Read())
                .ReturnsAsync(usedMemory);
            var redisMaxMemoryMock = new Mock<IRedisMaxMemory>();
            redisMaxMemoryMock
                .Setup(x => x.Read())
                .ReturnsAsync(maxMemory);
            var check = new RedisHasFreeMemory(redisMemoryUsageMock.Object, redisMaxMemoryMock.Object, options);

            // Act
            var result = await check.Check();

            // Assert
            Assert.That(result.Passed, Is.False);
        }
        public async Task CheckFailsWhenRedisMemoryUsageThrows()
        {
            // Arrange
            var redisMemoryUsageMock = new Mock<IRedisMemoryUsage>();
            var exception = new Exception("error message");
            redisMemoryUsageMock.Setup(x => x.Read()).ThrowsAsync(exception);
            var redisMaxMemoryMock = new Mock<IRedisMaxMemory>();
            var check = new RedisHasFreeMemory(redisMemoryUsageMock.Object, redisMaxMemoryMock.Object, new RedisHasFreeMemory.Options());

            // Act
            var result = await check.Check();

            // Assert
            Assert.That(result.Passed, Is.False);
            Assert.That(result.Output, Is.EqualTo(exception.Message));
        }
        public async Task CheckPassesWhenThereIsNoUpperLimitOnMemoryUsage()
        {
            // Arrange
            var redisMaxMemoryMock = new Mock<IRedisMaxMemory>();
            redisMaxMemoryMock.Setup(x => x.Read()).ReturnsAsync(null);
            var redisMemoryUsageMock = new Mock<IRedisMemoryUsage>();
            redisMemoryUsageMock.Setup(x => x.Read()).ReturnsAsync(1024);
            var check = new RedisHasFreeMemory(redisMemoryUsageMock.Object, redisMaxMemoryMock.Object, new RedisHasFreeMemory.Options());

            // Act
            var result = await check.Check();

            // Assert
            Assert.That(result.Passed, Is.True);
        }