public void EnumeratorCurrentTest() { EmailSinkData sinkA = new EmailSinkData(); sinkA.Name = "MyName"; sinkA.TypeName = "MyType"; sinkDataCollection.Add(sinkA); EmailSinkData sinkB = new EmailSinkData(); sinkB.Name = "MyName2"; sinkB.TypeName = "MyType2"; sinkDataCollection.Add(sinkB); int count = 0; foreach (SinkData sink1 in sinkDataCollection) { Assert.IsNotNull(sink1); count++; foreach (SinkData sink2 in sinkDataCollection) { Assert.IsNotNull(sink2); count++; } } Assert.AreEqual(6, count); }
public void Init() { XmlTextReader xmlReader = new XmlTextReader(new StringReader(xmlString)); XmlSerializer xmlSerializer = new XmlSerializer(typeof(SinkData)); this.data = xmlSerializer.Deserialize(xmlReader) as EmailSinkData; }
public void EmailSinkDataTest() { string fromAddress = "testFromAddress"; string name = "testName"; string smtpServer = "testSmtpServer"; string subjectLineEnder = "testSubjectLineEnder"; string subjectLineStarter = "testSubjectLineStarter"; string toAddress = "testToAddress"; string typeName = typeof(EmailSink).AssemblyQualifiedName; EmailSinkData data = new EmailSinkData(); data.FromAddress = fromAddress; data.Name = name; data.SmtpServer = smtpServer; data.SubjectLineEnder = subjectLineEnder; data.SubjectLineStarter = subjectLineStarter; data.ToAddress = toAddress; data.TypeName = typeName; EmailSinkNode node = new EmailSinkNode(data); GeneratedApplicationNode.Nodes.Add(node); EmailSinkData nodeData = (EmailSinkData)node.SinkData; Assert.AreEqual(fromAddress, nodeData.FromAddress); Assert.AreEqual(name, nodeData.Name); Assert.AreEqual(smtpServer, nodeData.SmtpServer); Assert.AreEqual(subjectLineEnder, nodeData.SubjectLineEnder); Assert.AreEqual(subjectLineStarter, nodeData.SubjectLineStarter); Assert.AreEqual(toAddress, nodeData.ToAddress); Assert.AreEqual(typeName, nodeData.TypeName); }
private bool ValidateParameters(LogEntry log) { EmailSinkData emailSinkData = GetEmailSinkDataFromView(); bool valid = true; if (emailSinkData.ToAddress == null || emailSinkData.ToAddress.Length == 0) { valid = false; } if (emailSinkData.FromAddress == null || emailSinkData.FromAddress.Length == 0) { valid = false; } if (emailSinkData.SmtpServer == null || emailSinkData.SmtpServer.Length == 0) { valid = false; } if (!valid) { string error = SR.EmailSinkMissingParameters; log.AddErrorMessage(error); this.defaultSink.SendMessage(log); } return(valid); }
private void EmailLogEntry(LogEntry logEntry, ILogFormatter formatter) { EmailSinkData emailSinkData = GetEmailSinkDataFromView(); EmailMessage emailMessage = CreateEmailMessage(emailSinkData, logEntry, formatter); emailMessage.Send(); }
public void EmailSink() { string sinkName = "SampleEmailSink"; EmailSinkData sink = new EmailSinkData(); sink.Name = sinkName; SinkFromFactory(sink); }
public void Setup() { sinkParams = new EmailSinkData(); sinkParams.ToAddress = "[email protected]"; sinkParams.FromAddress = "*****@*****.**"; sinkParams.SubjectLineStarter = "EntLib-Logging:"; sinkParams.SubjectLineEnder = "has occurred"; sinkParams.SmtpServer = "smtphost"; this.sink = new EmailSink(); this.sink.Initialize(new TestLogSinkConfigurationView(sinkParams)); CommonUtil.ResetEventLogCounter(); lastMailMessageSent = null; }
public void EmailSinkDataPropertiesTest() { EmailSinkData data = new EmailSinkData(); string fromAddress = "From Address"; string smtpServer = "Smtp Server"; string subjectLineEnder = "Subject Line ENd"; string subjectLineStarter = "Subject Line Start"; string toAddress = "To Address"; data.FromAddress = fromAddress; data.SmtpServer = smtpServer; data.SubjectLineEnder = subjectLineEnder; data.SubjectLineStarter = subjectLineStarter; data.ToAddress = toAddress; Assert.AreEqual(fromAddress, data.FromAddress); Assert.AreEqual(smtpServer, data.SmtpServer); Assert.AreEqual(subjectLineEnder, data.SubjectLineEnder); Assert.AreEqual(subjectLineStarter, data.SubjectLineStarter); Assert.AreEqual(toAddress, data.ToAddress); }
/// <summary> /// Creates node with specified configuration data. /// </summary> /// <param name="emailSinkData">Configuration data.</param> public EmailSinkNode(EmailSinkData emailSinkData) : base(emailSinkData) { this.emailSinkData = emailSinkData; }
public EmailMessage(EmailSinkData configurationData, LogEntry logEntry, ILogFormatter formatter) { this.configurationData = configurationData; this.logEntry = logEntry; this.formatter = formatter; }
internal virtual EmailMessage CreateEmailMessage(EmailSinkData sinkParameters, LogEntry logEntry, ILogFormatter formatter) { return(new EmailMessage(sinkParameters, logEntry, formatter)); }
public MockEmailMessage(EmailSinkData sinkParameters, LogEntry logEntry, ILogFormatter formatter) : base(sinkParameters, logEntry, formatter) { }
internal override EmailMessage CreateEmailMessage(EmailSinkData sinkParameters, LogEntry logEntry, ILogFormatter formatter) { return(new MockEmailMessage(sinkParameters, logEntry, formatter)); }