public void CreateNotification() { // Expected values. var expectedTitle = "Test Notification"; var expectedMessage = DateTime.Now.Ticks.ToString(); var expectedScheduledDate = DateTime.Now.AddHours(1); var expectedExtraInfo = new Dictionary <string, string>() { { "First Info", "First Value" }, { "Second Info", "Second Value" } }; // Create the notification. var notificationId = _schedulerToTest.Create(expectedTitle, expectedMessage, expectedScheduledDate, expectedExtraInfo); // See if we can find it and make sure all the values are set correctly. var foundNotification = _schedulerToTest.Find(notificationId); Assert.That(foundNotification, Is.Not.Null); Assert.That(foundNotification.Title, Is.EqualTo(expectedTitle)); Assert.That(foundNotification.Message, Is.EqualTo(expectedMessage)); var foundExtraInfo = foundNotification.ExtraInfo; Assert.That(foundExtraInfo, Is.Not.Null); Assert.AreEqual(expectedExtraInfo.Count, foundExtraInfo.Count); foreach (var ei in expectedExtraInfo) { Assert.That(foundExtraInfo.ContainsKey(ei.Key)); Assert.That(foundExtraInfo[ei.Key], Is.EqualTo(ei.Value)); } }
public void NotificationCanceled() { // Schedule a notifiaction. var notificationId = _schedulerToTest.Create("Test Notification", "Test notification message.", DateTime.Now.AddHours(1)); // Cancel it. _schedulerToTest.Cancel(notificationId); // Try to find it. Shouldn't find it because it has been cancelled. Assert.That(() => _schedulerToTest.Find(notificationId), Is.Null); }
public void NotificationDoesNotExist() { Assert.That(() => _schedulerToTest.Find("blah"), Is.Null); }