예제 #1
0
        public void BuildDefaultsToSecuredAnonymousConnectionWithAttachmentsTestUsingMailObject()
        {
            // Arrange
              var fromAddress = new MailAddress("*****@*****.**");
              var toAddress = new MailAddress("*****@*****.**");
              var anotherAddress = new MailAddress("*****@*****.**");

              // Act
              var builder = new EmailDestinationBuilder(fromAddress, new[] { toAddress, anotherAddress }, ServerName);
              builder = builder.SendAttachments();
              string result = builder.Build();
              Mail mail = new Mail(result);

              // Assert
              Assert.Equal("*****@*****.**", mail.From);
              Assert.Equal("[email protected],[email protected]", mail.To);
              Assert.Equal(true, mail.UseAttachment);
              Assert.Equal(ServerName, mail.SmtpServer);
              Assert.Equal(true, mail.UseSsl);
              Assert.Equal(465, mail.Port);
              Assert.Equal(false, mail.UseAuthentication);
        }
예제 #2
0
파일: MainForm.cs 프로젝트: hglee/NBug
        private void loader_RemoveDestination(object sender, EventArgs e)
        {
            var loader = sender as PanelLoader;
            var idx = 2;
            idx += this.panelLoaders.ToList().IndexOf(loader);

            if (!string.IsNullOrEmpty(loader.connString))
            {
                var protocol = ConnectionStringParser.Parse(loader.connString)["Type"];
                IProtocol dest = null;

                if (protocol == typeof(Mail).Name || protocol.ToLower() == "email" || protocol.ToLower() == "e-mail")
                {
                    dest = new Mail(loader.connString);
                }
                else if (protocol == typeof(Redmine).Name)
                {
                    dest = new Redmine(loader.connString);
                }
                else if (protocol == typeof(Ftp).Name)
                {
                    dest = new Redmine(loader.connString);
                }
                else if (protocol == typeof(Http).Name)
                {
                    dest = new Redmine(loader.connString);
                }

                if (dest != null)
                {
                    Settings.Destinations.Remove(dest);
                }
            }

            this.panelLoaders.Remove(loader);
            this.mainTabs.TabPages.RemoveAt(idx);
            return;
        }