Ejemplo n.º 1
0
        public void Switch_calls_secondary_service_silently_when_default_service_fails()
        {
            // arrange
            string result = string.Empty;

            redisService.Put("testKey", "alternativePathValue");
            dummyServiceMock.Setup(x => x.Get(It.IsAny <string>())).Throws <TimeoutException>();

            sut.TryFirst(() => result = dummyServiceMock.Object.Get("testKey"))
            .Otherwise(() => result   = redisService.Get("testKey"));

            // act
            sut.Execute();

            // assert
            Assert.Equal("alternativePathValue", result);
        }