Exemple #1
0
 private void AddHeader(Activity activity)
 {
     stream.Seek(0, SeekOrigin.End);
     var sw = new StreamWriter(stream);
     sw.WriteLine(string.Join(" ; ", activity.List().Keys));
     sw.Flush();
 }
Exemple #2
0
 public Activity(Activity oldActivity,Dictionary<string,string> newActivityElements)
 {
     activity = oldActivity.List();
     foreach (var key in newActivityElements.Keys)
         activity[key] = newActivityElements[key];
     ValidateDate();
 }
Exemple #3
0
 public Project(Activity activity)
 {
     var act = activity.List();
     name = act["project"];
     count = 1;
     duration = DateTime.Parse(act["enddate"]) - DateTime.Parse(act["date"]);
     activities.Add(activity);
 }
 public void Activity_Contain_Date()
 {
     var activity = new Activity("Test");
     DateTime dateParse;
     var containDate = false;
     if (DateTime.TryParse(activity.List()["date"], CultureInfo.DefaultThreadCurrentUICulture, DateTimeStyles.None, out dateParse))
         containDate = true;
     containDate.ShouldBeTrue();
 }
 public void Calculating_the_duration_of_an_activity()
 {
     var dictionary = new Dictionary<string, string>()
         {
             {"project","n/a" },
             {"date","11.11.2016" },
             {"enddate", "12.11.2016"},
             {"message","Old message" }
         };
     var activity = new Activity(dictionary);
     activity.List()["duration"].ShouldContain("1d 00h 00m");
 }
 public void Autocomplete_date_if_contain_only_years_months_days()
 {
     var dictionary = new Dictionary<string, string>()
         {
             {"project","n/a" },
             {"date","11.11.2016" },
             {"enddate", "11.11.2017"},
             {"message","Old message" }
         };
     var activity = new Activity(dictionary);
     activity.List()["enddate"].ShouldContain("11.11.2017 00:00:00");
 }
Exemple #7
0
 private static void Spacing(StringBuilder builder, Activity activity, bool addHeader = false)
 {
     var numberOfSpace = new Dictionary<string, int>
     {
         {$"id", 12},
         {$"project", 14},
         {$"date", 22},
         {$"enddate", 22},
         {$"duration",20 },
         {$"message", 100}
     };
     foreach (var element in activity.List())
     {
         var appendString = addHeader ? element.Key.ToUpper() : element.Value;
         if (numberOfSpace[element.Key] - appendString.Length > 2)
         {
             Append(builder, appendString, numberOfSpace[element.Key] - appendString.Length);
         }
         else
         {
             Append(builder, appendString.Substring(0, numberOfSpace[element.Key] - 6) + "...", 3);
         }
     }
     builder.Append(Environment.NewLine);
 }
 public void New_activity_with_enddate()
 {
     var dictionary = new Dictionary<string, string>()
         {
             {"project","n/a" },
             {"enddate", "11.11.2017"},
             {"message","Old message" }
         };
     var activity = new Activity(dictionary);
     activity.List()["enddate"].ShouldContain("11.11.2017");
 }
 public void New_activity_should_contain_a_project_label()
 {
     var activity = new Activity("Test", "Project I");
     activity.List()["project"].Equals("Project I");
 }
 public void New_activity_has_no_project()
 {
     var activity = new Activity("Test");
     activity.List()["project"].ShouldEqual("");
 }
 public void Activity_Not_Contain()
 {
     var activity = new Activity("Test");
     activity.List()["message"].ShouldNotEqual("Testt");
 }
 public void Activity_List_Return_A_Value()
 {
     var activity = new Activity("Test");
     activity.List().ShouldNotBeNull();
 }
 public void Activity_Contain_Exact_Message()
 {
     var activity = new Activity("Test");
     activity.List()["message"].ShouldEqual("Test");
 }
Exemple #14
0
 public void AddActivity(Activity activity)
 {
     count++;
     duration+=(DateTime.Parse(activity.List()["enddate"]) - DateTime.Parse(activity.List()["date"]));
     activities.Add(activity);
 }