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(); }
private IConnectionHistory RecordHistoryItemToFilePersistence() { IFavorite favorite = this.AddFavorite(); IConnectionHistory history = this.Persistence.ConnectionHistory; history.RecordHistoryItem(favorite); return(history); }
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()); }
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"); }
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"); }