public void TestResolveWithDefaultConfigurationWithoutFactoriesReturnsNoopSender() { var senderResolver = new SenderResolver(_loggerFactory); var sender = senderResolver.Resolve(); Assert.IsType <NoopSender>(sender); }
public void TestResolveWithTest1SelectedWithoutFactoriesReturnsNoopSender() { var senderResolver = new SenderResolver(_loggerFactory); var configuration = new Configuration.SenderConfiguration(_loggerFactory) .WithSenderFactory(FACTORY_NAME_TEST1); var sender = senderResolver.Resolve(configuration); Assert.IsType <NoopSender>(sender); }
/// <summary> /// Returns a sender if one was given when creating the configuration, or attempts to create a sender based on the /// configuration's state. /// </summary> /// <returns>The sender passed via the constructor or a properly configured sender.</returns> public virtual ISender GetSender() { if (SenderResolver == null) { SenderResolver = DefaultSenderResolver; } if (Sender == null) { Sender = SenderResolver.Resolve(this); } return(Sender); }
public void TestResolveWithTest2SelectedWithTest2FactoryReturnsFlexibleSender() { var configuration = new Configuration.SenderConfiguration(_loggerFactory) .WithSenderFactory(FACTORY_NAME_TEST2); var senderResolver = new SenderResolver(_loggerFactory) .RegisterSenderFactory(_test2SenderFactory); var sender = senderResolver.Resolve(configuration); Assert.IsType <FlexibleSenderFactory.Sender>(sender); var flexibleSender = (FlexibleSenderFactory.Sender)sender; Assert.Equal(FACTORY_NAME_TEST2, flexibleSender.FactoryName); Assert.Equal(configuration, flexibleSender.SenderConfiguration); }
public RemoteReporter Build() { if (_loggerFactory == null) { _loggerFactory = NullLoggerFactory.Instance; } if (_sender == null) { var senderResolver = new SenderResolver(_loggerFactory); _sender = senderResolver.Resolve(); } if (_metrics == null) { _metrics = new MetricsImpl(NoopMetricsFactory.Instance); } return(new RemoteReporter(_sender, _flushInterval, _maxQueueSize, _metrics, _loggerFactory)); }