public void WhenFailoverModeEnabledIsFalseThenDoNotCallCountFailedEntries() { var failoverRepository = new Mock <IFailoverRepository>(); var config = new Mock <IConfigManager>(); config.Setup(x => x.IsFailoverModeEnabled).Returns(false); var failoverService = new FailoverService(failoverRepository.Object, config.Object); var isFailoverMode = failoverService.IsFailoverMode(); failoverRepository.Verify(x => x.CountFailedEntries(It.IsAny <int>()), Times.Never()); }
public void WhenFailoverModeEnabledIsTrueAndFailedCountIsUnderLimitReturnFalse() { var failoverRepository = new Mock <IFailoverRepository>(); var config = new Mock <IConfigManager>(); config.Setup(x => x.IsFailoverModeEnabled).Returns(true); config.Setup(x => x.FailoverMinutes).Returns(It.IsAny <int>()); config.Setup(x => x.FailedRequestLimit).Returns(100); failoverRepository.Setup(x => x.CountFailedEntries(It.IsAny <int>())).Returns(5); var failoverService = new FailoverService(failoverRepository.Object, config.Object); var isFailoverMode = failoverService.IsFailoverMode(); Assert.AreEqual(false, isFailoverMode); }