コード例 #1
0
        public MailDispatcherTests(ITestOutputHelper output)
        {
            _queue          = new MockMailQueue();
            _transfer       = new MockMailTransferQueue();
            _mailbox        = new MockMailboxStore();
            _domainSettings = new DomainSettings(
                new[]
            {
                new DistributionList(
                    "*****@*****.**",
                    "Internal only list",
                    new[] { "*****@*****.**" },
                    new[] { "*****@*****.**", "*****@*****.**" },
                    false,
                    true
                    ),
                new DistributionList(
                    "*****@*****.**",
                    "Disabled list",
                    new[] { "*****@*****.**" },
                    new[] { "*****@*****.**", "*****@*****.**" }
                    ),
                new DistributionList(
                    "*****@*****.**",
                    "External list",
                    new[] { "*****@*****.**" },
                    new[]
                {
                    "*****@*****.**",
                    "*****@*****.**",
                    "*****@*****.**",
                    "*****@*****.**"
                },
                    true,
                    true
                    )
            },
                new Dictionary <string, string>
            {
                { "*****@*****.**", "*****@*****.**" }
            });
            AgentSettings settings = TestHelpers.MakeSettings(
                "example.com",
                new[] { new SmtpAcceptDomain("example.com") },
                relayDomains: new[] { new SmtpRelayDomain("relay.example.com", "relay.example.com") },
                idleDelay: 1);

            _dispatcher = new MailDispatcher(
                _queue,
                _mailbox,
                _transfer,
                new TestOutputLogger(output),
                new MockDomainResolver(_domainSettings),
                null,
                new MockVolatile <AgentSettings>(settings));
        }
コード例 #2
0
        private static (MockMailQueue, MockMailBuilder, MockSmtpChannel, DataCommand) Prepare(
            string content         = "",
            AgentSettings settings = null)
        {
            var queue = new MockMailQueue();

            settings = settings ?? TestHelpers.MakeSettings();
            var builder = new MockMailBuilder();
            var channel = new MockSmtpChannel();
            var command = new DataCommand(
                queue,
                settings,
                TestHelpers.GetReader(content),
                new ConnectionInformation("local", "remote"),
                builder,
                channel
                );

            return(queue, builder, channel, command);
        }