Commit fd4415a6 authored by Alexandre Meyer's avatar Alexandre Meyer

En tenant comptes des remarques de Sepehr émise le 21 Août.

parent de9a21c7
......@@ -8,43 +8,70 @@ using System.Threading.Tasks;
namespace Test
{
public static class DataGenerator
public static class Utils
{
public static XMLLoad GenerateTestXMLAndReplaceString(string StringToReplace, string StringSubstitute)
private static string GenerateTestXML()
{
StringBuilder data = new StringBuilder();
data.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
data.AppendLine("<mailings>");
data.AppendLine("<mailing nom=\"TestXMLLoad\">");
data.AppendLine("<summary>Test du XML Load</summary>");
data.AppendLine("<location>Salle OQP</location>");
data.AppendLine("<description>Xml de test générer a la volé</description>");
data.AppendLine("<days>");
data.AppendLine("<day>0</day>");
//data.AppendLine("<day>2</day>");
//data.AppendLine("<day>4</day>");
data.AppendLine("</days>");
data.AppendLine("<startHour>10</startHour>");
data.AppendLine("<duration>15</duration>");
data.AppendLine("<attendees>");
data.AppendLine("<emails>");
data.AppendLine("<email>");
data.AppendLine("<value>testEmail@soat.fr</value>");
data.AppendLine("<name>Prenom Nom</name>");
data.AppendLine("<dir>INT</dir>");
data.AppendLine("<dispos>");
data.AppendLine("<day>0</day>");
data.AppendLine("<day>2</day>");
data.AppendLine("<day>4</day>");
data.AppendLine("</dispos>");
data.AppendLine("</email>");
data.AppendLine("<email>");
data.AppendLine("<value>testEmail2@soat.fr</value>");
data.AppendLine("<name>Prenom2 Nom2</name>");
data.AppendLine("<dir>DSI</dir>");
data.AppendLine("<dispos>");
data.AppendLine("<day>0</day>");
data.AppendLine("<day>1</day>");
data.AppendLine("<day>2</day>");
data.AppendLine("<day>3</day>");
data.AppendLine("<day>4</day>");
data.AppendLine("</dispos>");
data.AppendLine("</email>");
data.AppendLine("</emails>");
data.AppendLine("</attendees>");
data.AppendLine("<type>Week</type>");
data.AppendLine("</mailing>");
data.AppendLine("</mailings>");
return data.ToString();
}
public static XMLFile GenerateTestXMLAndReplaceString(string StringToReplace, string StringSubstitute)
{
String XMLTestFileName = "FichierDeTest.xml";
using (StreamWriter fileTestStreamWriter =
new StreamWriter(XMLTestFileName))
{
fileTestStreamWriter.WriteLine(GenerateXML().Replace(matchString, changeString));
fileTestStreamWriter.WriteLine(GenerateTestXML().Replace(matchString, changeString));
}
XMLLoad Testxml = new XMLLoad(XMLTestFileName);
XMLFile Testxml = new XMLFile (XMLTestFileName);
return Testxml;
}
public static Memory GenerateMemoryFromADate(DateTime userdate)
{
Memory GeneratedMemoryFromADate = new Memory();
List<string> emailsList = new List<string> { "testEmail@soat.fr", "testEmail2@soat.fr" };
LastMailingSendInfo LastInformations = new LastMailingSendInfo("TestXMLLoad", emailsList, userdate);
GeneratedMemoryFromADate.MyMemoryMailingValue.Add(LastInformations.Name, LastInformations);
return GeneratedMemoryFromADate;
}
public static DateTime GenerateFirstDayOfCurrentMonthOrFirstDayOfMonthBefore()
{
DateTime DateOfNowOrYesterday = (DateTime.Now.Day == 1) ? DateTime.Now.AddDays(-1) : DateTime.Now;
DateTime FirstDayOfCurrentBeforeToday = new DateTime(DateOfNowOrYesterday.Year, DateOfNowOrYesterday.Month, 1);
return FirstDayOfCurrentBeforeToday;
}
}
}
}
......@@ -73,27 +73,5 @@ namespace Test
return xml;
}
public static Memory GenerateMemory(DateTime date)
{
Memory result = new Memory();
List<string> email = new List<string> { "testEmail@soat.fr", "testEmail2@soat.fr" };
LastMailingSendInfo lmsi = new LastMailingSendInfo("TestXMLLoad", email, date);
result.MyMemoryMailingValue.Add(lmsi.Name, lmsi);
return result;
}
public static DateTime GenerateFirstMonthDayBeforToday()
{
DateTime result = (DateTime.Now.Day == 1) ? DateTime.Now.AddDays(-1) : DateTime.Now;
result = new DateTime(result.Year, result.Month, 1);
return result;
}
}
}
......@@ -6,16 +6,16 @@ using System.Threading.Tasks;
namespace SPAM
{
public class LastMailingSendInfo
public class Mail
{
public DateTime SentDate { get; }
public List<string> Emails { get; }
public string Name { get; }
public string Label { get; }
public LastMailingSendInfo(string _name, List<string> _emails, DateTime _SentDate)
public Mail(string _Label, List<string> _emails, DateTime _SentDate)
{
Emails = _emails;
Name = _name;
Label = _Label;
SentDate = _SentDate.Date;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment