コード例 #1
0
        public void Switch_calls_secondary_action_silently_when_default_action_fails()
        {
            // arrange
            sut.TryFirst(failingAction).Otherwise(secondryAction);

            // act
            sut.Execute();

            // assert
            Assert.True(true); // happend to come this far.
        }
コード例 #2
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);
        }