コード例 #1
0
        public static void ConfigureTrackers(AbstractScheduledItem <ScheduleSettings> data, DateRange dateRange,
                                             MtObservableCollection <ITracker> trackers)
        {
            var start  = dateRange.StartDate.Date;
            var finish = dateRange.FinishDate.Date;

            if (start > finish)
            {
                return;
            }

            trackers.Clear();

            do
            {
                var tracker = data.Schedule.Trackers.FirstOrDefault(t => t.ScheduledDate.Date == start);

                if (tracker == null)
                {
                    trackers.Add(new TrackerCap()
                    {
                        ScheduledDate = start
                    });
                }
                else
                {
                    trackers.Add(tracker);
                }

                start = start.AddDays(1);
            } while (finish >= start);
        }
コード例 #2
0
        public void When_clearing_items_then_event_must_contain_all_items()
        {
            //// Arrange
            Given_a_collection_with_multiple_items();

            //// Act
            _collection.Clear();

            //// Assert
            Assert.AreEqual(0, _collection.Count);
            Assert.AreEqual(0, _addedItems.Count);
            Assert.AreEqual(4, _removedItems.Count);
        }