public void TestSplitByType_EmptyList_ExtensionMethod() { TrainingDayDTO day = new TrainingDayDTO(DateTime.Now); var groups = day.SplitByType(true); Assert.AreEqual(0, groups.Count); }
public void TestSplitByType_LoadedOnly_ExtensionMethod() { TrainingDayDTO day = new TrainingDayDTO(DateTime.Now); day.AddEntry(new MyEntry1()); day.AddEntry(new MyEntry3()); day.AddEntry(new MyEntry1()); var groups = day.SplitByType(true); Assert.AreEqual(1, groups.Count); Assert.AreEqual(2, groups[typeof(MyEntry1)].Count); }
public DateItem AddDayInfo(MonthCalendar calendar, TrainingDayDTO day) { var options = UserContext.Settings.GuiState.CalendarOptions; var groupedEntries = day.SplitByType(!options.ShowMissingPlugins); DateItem item = new DateItem(); Bitmap bitmap = new Bitmap(1, 1); bool showUnloaded = false; ICalendarDayContent dayContent = DayContent; foreach (KeyValuePair <Type, List <EntryObjectDTO> > groupedEntry in groupedEntries) { if (dayContent != null && dayContent.SupportedEntryType == groupedEntry.Key) { item.Text = dayContent.GetDayInfoText(groupedEntry.Value); item.BackColor1 = dayContent.GetBackColor(groupedEntry.Value); } var entryProvider = PluginsManager.Instance.GetEntryObjectProvider(groupedEntry.Key); if (entryProvider != null) { bool show = true; if (!options.ShowIcons.TryGetValue(entryProvider.GlobalId, out show) || show) { bitmap = combineImages(bitmap, entryProvider.ModuleImage); } } else { showUnloaded = true; } } if (showUnloaded) { bitmap = combineImages(bitmap, Icons.PluginMissing); } calendar.RemoveDateInfo(day.TrainingDate); item.Image = bitmap; item.Date = day.TrainingDate; item.Tag = day; calendar.AddDateInfo(item); return(item); }