public void Should_invoke_action_with_the_working_channel() { _connectionFactory1.Setup(x => x.CreateConnection()).Throws <Exception>(); var conn2 = new Mock <IConnection>(); _connectionFactory2.Setup(x => x.CreateConnection()).Returns(conn2.Object); conn2.Setup(x => x.CreateModel()).Throws <Exception>(); var conn3 = new Mock <IConnection>(); var chan3 = new Mock <IModel>(); _connectionFactory3.Setup(x => x.CreateConnection()).Returns(conn3.Object); conn3.Setup(x => x.CreateModel()).Returns(chan3.Object); IModel passedChan = null; Exception passedExc = null; _sut.Try(c => passedChan = c, e => passedExc = e); Assert.That(passedChan, Is.SameAs(chan3.Object)); Assert.That(passedExc, Is.Null); _confirmStrategy.Verify(x => x.ChannelCreated(chan3.Object)); }