public void LoadFromString_WithEmptyString_ThrowsException() { Assert.Throws <ArgumentNullException>(() => { _configuration = EmailReportingConfiguration.LoadFromString(string.Empty, _reportKeys); }); }
public void LoadFromString_WithMissingRootElement_ThrowsException() { Assert.Throws <XmlException>(() => { _configuration = EmailReportingConfiguration.LoadFromString( EmailReportingConfigurationData.MISSING_ROOT_CONFIG, _reportKeys ); }); }
public void LoadFromString_WithWrongRootElement_ThrowsException() { Assert.Throws <FormatException>(() => { _configuration = EmailReportingConfiguration.LoadFromString( EmailReportingConfigurationData.MISSING_ELEMENT_CONFIG, _reportKeys ); }); }
public void LoadFromString_WithInvalidPort_ThrowsException() { Assert.Throws <FormatException>(() => { _configuration = EmailReportingConfiguration.LoadFromString( EmailReportingConfigurationData.INVALID_PORT_CONFIG, _reportKeys ); }); }
public void LoadFromString_WithMissingSubject_ThrowsException() { Assert.Throws <FormatException>(() => { _configuration = EmailReportingConfiguration.LoadFromString( EmailReportingConfigurationData.MISSING_SUBJECT_CONFIG, _reportKeys ); }); }
public void LoadFromString_WithMissingAttribute_ThrowsException() { Assert.Throws <FormatException>(() => { _configuration = EmailReportingConfiguration.LoadFromString( EmailReportingConfigurationData.MISSING_ATTRIBUTE_CONFIG, _reportKeys ); }); }
public void LoadFromString_WithNoReports_ReturnsNoReports() { _configuration = EmailReportingConfiguration.LoadFromString( EmailReportingConfigurationData.NO_REPORTS_CONFIG, new List <string>() ); Assert.AreEqual(EmailReportingConfigurationData.SENDER_EMAIL, _configuration.SenderEmail); Assert.AreEqual(EmailReportingConfigurationData.PASSWORD, _configuration.Password); Assert.AreEqual(EmailReportingConfigurationData.MAIL_SERVER, _configuration.MailServer); Assert.AreEqual(EmailReportingConfigurationData.PORT, _configuration.Port); Assert.AreEqual(0, _configuration.ReportCount); }
public void LoadFromString_WithAReport_ReturnsReportInfo() { _configuration = EmailReportingConfiguration.LoadFromString(EmailReportingConfigurationData.ONE_REPORT_CONFIG, _reportKeys); ReportEmailConfiguration report = _configuration.GetReportEmailConfiguration(EmailReportingConfigurationData.REPORT_NAME); Assert.AreEqual(EmailReportingConfigurationData.SENDER_EMAIL, _configuration.SenderEmail); Assert.AreEqual(EmailReportingConfigurationData.PASSWORD, _configuration.Password); Assert.AreEqual(EmailReportingConfigurationData.MAIL_SERVER, _configuration.MailServer); Assert.AreEqual(EmailReportingConfigurationData.PORT, _configuration.Port); Assert.AreEqual(1, _configuration.ReportCount); Assert.AreEqual(EmailReportingConfigurationData.REPORT_NAME, report.ReportName); Assert.AreEqual(EmailReportingConfigurationData.RECIPIENT, report.ToList.FirstOrDefault()); Assert.IsNull(report.CcList.FirstOrDefault()); Assert.AreEqual(EmailReportingConfigurationData.SUBJECT, report.Subject); }