Esempio n. 1
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);
 }
Esempio n. 2
0
 public Activity(Activity oldActivity,Dictionary<string,string> newActivityElements)
 {
     activity = oldActivity.List();
     foreach (var key in newActivityElements.Keys)
         activity[key] = newActivityElements[key];
     ValidateDate();
 }
Esempio n. 3
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();
 }
Esempio n. 4
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);
 }
Esempio n. 5
0
 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();
 }
Esempio n. 6
0
 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");
 }
Esempio n. 7
0
 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");
 }
Esempio n. 8
0
 public void Activity_Not_Contain()
 {
     var activity = new Activity("Test");
     activity.List()["message"].ShouldNotEqual("Testt");
 }
Esempio n. 9
0
 public void CSV_Repository_Should_Contain_added_activity()
 {
     var csv = new DocumentCSV(new MemoryStream());
     var activity = new Activity("First add");
 }
Esempio n. 10
0
 public void New_activity_with_end_date_sooner_than_start_date()
 {
     var dictionary = new Dictionary<string, string>()
         {
             {"project","n/a" },
             {"date","11.11.2018" },
             {"enddate", "11.11.2017 11:11:11"},
             {"message","Old message" }
         };
     var activity = new Activity(dictionary);
 }
Esempio n. 11
0
 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");
 }
Esempio n. 12
0
 public void New_activity_should_contain_a_project_label()
 {
     var activity = new Activity("Test", "Project I");
     activity.List()["project"].Equals("Project I");
 }
Esempio n. 13
0
 public void New_activity_has_no_project()
 {
     var activity = new Activity("Test");
     activity.List()["project"].ShouldEqual("");
 }
Esempio n. 14
0
 public void AddActivity(Activity activity)
 {
     count++;
     duration+=(DateTime.Parse(activity.List()["enddate"]) - DateTime.Parse(activity.List()["date"]));
     activities.Add(activity);
 }
Esempio n. 15
0
 public void Activity_List_Return_A_Value()
 {
     var activity = new Activity("Test");
     activity.List().ShouldNotBeNull();
 }
Esempio n. 16
0
 public void Activity_Has_Value()
 {
     var activity = new Activity("Test");
     activity.ShouldNotBeNull();
 }
Esempio n. 17
0
 public void Activity_Contain_Exact_Message()
 {
     var activity = new Activity("Test");
     activity.List()["message"].ShouldEqual("Test");
 }
Esempio n. 18
0
 public void New_activity_with_invalid_date()
 {
     var dictionary = new Dictionary<string, string>()
         {
             {"project","n/a" },
             {"date","11.11.2018" },
             {"enddate", "11.11.2017 11:11:11s"},
             {"message","Old message" }
         };
     var activity = new Activity(dictionary);
 }