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 Activity(Activity oldActivity,Dictionary<string,string> newActivityElements) { activity = oldActivity.List(); foreach (var key in newActivityElements.Keys) activity[key] = newActivityElements[key]; ValidateDate(); }
private void AddHeader(Activity activity) { stream.Seek(0, SeekOrigin.End); var sw = new StreamWriter(stream); sw.WriteLine(string.Join(" ; ", activity.List().Keys)); sw.Flush(); }
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"); }
public void Activity_Not_Contain() { var activity = new Activity("Test"); activity.List()["message"].ShouldNotEqual("Testt"); }
public void CSV_Repository_Should_Contain_added_activity() { var csv = new DocumentCSV(new MemoryStream()); var activity = new Activity("First add"); }
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); }
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 AddActivity(Activity activity) { count++; duration+=(DateTime.Parse(activity.List()["enddate"]) - DateTime.Parse(activity.List()["date"])); activities.Add(activity); }
public void Activity_List_Return_A_Value() { var activity = new Activity("Test"); activity.List().ShouldNotBeNull(); }
public void Activity_Has_Value() { var activity = new Activity("Test"); activity.ShouldNotBeNull(); }
public void Activity_Contain_Exact_Message() { var activity = new Activity("Test"); activity.List()["message"].ShouldEqual("Test"); }
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); }