private static DateTime GetRecordedDate(IConnectionHistory history)
 {
     var historyAccesor = new PrivateObject(history);
     var recordedItems = historyAccesor.Invoke("GetGroupedByDate") as SerializableDictionary<string, SortableList<IHistoryItem>>;
     var foundItem = recordedItems.SelectMany(group => group.Value).First();
     return foundItem.Date.ToUniversalTime();
 }
示例#2
0
        private IConnectionHistory RecordHistoryItemToFilePersistence()
        {
            IFavorite          favorite = this.AddFavorite();
            IConnectionHistory history  = this.Persistence.ConnectionHistory;

            history.RecordHistoryItem(favorite);
            return(history);
        }
示例#3
0
        private static DateTime GetRecordedDate(IConnectionHistory history)
        {
            var historyAccesor = new PrivateObject(history);
            var recordedItems  = historyAccesor.Invoke("GetGroupedByDate") as SerializableDictionary <string, SortableList <IHistoryItem> >;
            var foundItem      = recordedItems.SelectMany(group => group.Value).First();

            return(foundItem.Date.ToUniversalTime());
        }
示例#4
0
        public void HistoryDateTimeIsInUtcTest()
        {
            InjectionDateTime.SetTestDateTime();
            IConnectionHistory history      = RecordHistoryItemToFilePersistence();
            DateTime           recordedDate = GetRecordedDate(history);

            Assert.AreEqual(recordedDate, Moment.Now, "Correct date wasn't delivered to the history file");
        }
示例#5
0
        public void ClearHistoryTest()
        {
            this.Persistence.ConnectionHistory.HistoryClear += new Action(PrimaryHistory_HistoryClear);
            InjectionDateTime.SetTestDateTime();
            IConnectionHistory history = RecordHistoryItemToFilePersistence();

            history.Clear();
            int historyItems = history.GetDateItems(HistoryIntervals.TODAY).Count;

            Assert.AreEqual(0, historyItems, "File history wasnt clear properly");
            Assert.AreEqual(1, historyClearReported, "History clear wasnt reported properly");
        }