public void TestAddFilesToHistory() { var firstFile = new HistoryItem() { Position = 0.1f, FilePath = "File1", Volume = 1d, PlayedDate = DateTime.Now }; m_model.LastPlayedFile = firstFile; var secondFile = new HistoryItem() { Position = 0.1f, FilePath = "File2", Volume = 1d, PlayedDate = DateTime.Now }; m_model.LastPlayedFile = secondFile; var historyItem = m_model.GetHistoryInfo(firstFile.FilePath); Assert.IsNotNull(historyItem); Assert2ItemsAreEqual(firstFile, historyItem); historyItem = m_model.GetHistoryInfo(secondFile.FilePath); Assert.IsNotNull(historyItem); Assert2ItemsAreEqual(secondFile, historyItem); }
public void SaveLastPlayInfo() { if (m_model.CurrentFilePath != null) { var item = new HistoryItem() { Position = m_model.Position, FilePath = m_model.CurrentFilePath, Volume = m_model.Volume, PlayedDate = DateTime.Now }; HistoryModel.Instance.LastPlayedFile = item; HistoryModel.Instance.Save(); } }
private void AddItem(HistoryItem item) { if (m_historyItems.Count != 0) { Trace.Assert(item.PlayedDate >= m_historyItems[0].PlayedDate); } var matched = m_historyItems.Find(i => i.FilePath == item.FilePath); m_historyItems.RemoveAll(i => i.FilePath == item.FilePath); m_historyItems.Insert(0, item); }
public void TestPlaySameFileServalTimes() { var playedYesterday = new HistoryItem() { Position = 0.1f, FilePath = "File1", Volume = 1d, PlayedDate = DateTime.Now - TimeSpan.FromDays(1d) }; m_model.LastPlayedFile = playedYesterday; var playedToday = new HistoryItem() { Position = 0.2f, FilePath = playedYesterday.FilePath, Volume = 0.5d, PlayedDate = DateTime.Now }; m_model.LastPlayedFile = playedToday; var historyItem = m_model.GetHistoryInfo(playedToday.FilePath); Assert.IsNotNull(historyItem); Assert2ItemsAreEqual(playedToday, historyItem); Assert2ItemsAreEqual(playedToday, m_model.LastPlayedFile); }
private static void Assert2ItemsAreEqual(HistoryItem expected, HistoryItem historyItem) { Assert.AreEqual(expected.FilePath, historyItem.FilePath); Assert.AreEqual(expected.Position, historyItem.Position); Assert.AreEqual(expected.PlayedDate, historyItem.PlayedDate); Assert.AreEqual(expected.Volume, historyItem.Volume); }
public void TestSetLastPlayedFile() { var expected = new HistoryItem() { Position = 0.1f, FilePath = "DummyPath", Volume = 1d, PlayedDate = DateTime.Now }; m_model.LastPlayedFile = expected; Assert2ItemsAreEqual(expected, m_model.LastPlayedFile); var historyItem = m_model.GetHistoryInfo(expected.FilePath); Assert.IsNotNull(historyItem); Assert2ItemsAreEqual(expected, historyItem); }
public HistoryItemUI(HistoryItem item) { m_item = item; }