public void CreateDefaultMessagingScenarioFactoryUsesFallbackWhenNoConfig() { ResetFactory(); ResetConfig(); var mockFactory = new Mock <IMessagingScenarioFactory>(); MessagingScenarioFactory.SetFallback(mockFactory.Object); var factory = CallPrivateCreateDefault(); factory.Should().BeSameAs(mockFactory.Object); }
public void CreateDefaultMessagingScenarioFactoryThrowsWhenNoConfigAndNoFallback() { ResetFactory(); ResetConfig(); MessagingScenarioFactory.SetFallback(null); try { CallPrivateCreateDefault(); } catch (TargetInvocationException ex) { ex.InnerException.Should().BeOfType <InvalidOperationException>(); ex.InnerException.Message.Should() .Be("MessagingScenarioFactory.Current has no value. The value can be set via config or by calling the SetCurrent method."); } }