public string SendMessage_ToOnly(string to)
        {
            // Setup
            var provider = new LinuxEmailProviderDummy();
            var email    = provider.CreateMessage();

            email.To.AddRange(to.Split(';'));
            email.Subject = "Testing";
            email.Body    = "Hi there!";

            // Exercise
            provider.SendMessage(email);

            // Verify
            return(provider.GetCommandLine());
        }
        public void SendMessage_Attachment(string cc, string bcc, int noOfAttachments, string expected)
        {
            // Setup
            var provider = new LinuxEmailProviderDummy();
            var email    = provider.CreateMessage();

            email.To.Add("*****@*****.**");
            if (cc != null)
            {
                email.Cc.AddRange(cc.Split(';'));
            }
            if (bcc != null)
            {
                email.Bcc.AddRange(bcc.Split(';'));
            }
            email.Subject = "Testing";
            email.Body    = "Hi there!";
            var tempFiles = new List <TempFile>();

            try
            {
                var bldr = new StringBuilder();
                for (var i = 0; i < noOfAttachments; i++)
                {
                    var tempFile = new TempFile($"SendMessage_Attachment{i}");
                    tempFiles.Add(tempFile);
                    email.AttachmentFilePath.Add(tempFile.Path);
                    bldr.Append($" --attach '{tempFile.Path}'");
                }

                // Exercise
                provider.SendMessage(email);

                // Verify
                var fullExpected = expected.Replace(" $ATTACH", bldr.ToString());
                Assert.That(provider.GetCommandLine(), Is.EqualTo(fullExpected));
            }
            catch
            {
                foreach (var tempFile in tempFiles)
                {
                    tempFile.Dispose();
                }
                throw;
            }
        }
        public string SendMessage_CcAndBcc(string cc, string bcc)
        {
            // Setup
            var provider = new LinuxEmailProviderDummy();
            var email    = provider.CreateMessage();

            email.To.Add("*****@*****.**");
            if (cc != null)
            {
                email.Cc.AddRange(cc.Split(';'));
            }
            if (bcc != null)
            {
                email.Bcc.AddRange(bcc.Split(';'));
            }
            email.Subject = "Testing";
            email.Body    = "Hi there!";

            // Exercise
            provider.SendMessage(email);

            // Verify
            return(provider.GetCommandLine());
        }