public void ShouldThrowArgumentNullException_WhenUpdateItemIsNull()
        {
            var storage = new ReminderItemStorage();

            Assert.Catch <ArgumentNullException>(() =>
                                                 storage.Update(null)
                                                 );
        }
예제 #2
0
 public void WhenUpdateItemDoesnExist_ThenThrowsArgumentException()
 {
     var storage  = new ReminderItemStorage();
     var reminder = new ReminderItem(Guid.NewGuid()
                                     , "Test1"
                                     , "Reminder1"
                                     , DateTimeOffset.UtcNow
                                     , "UserName");
     var exeption = Assert.Catch <ArgumentException>(() => storage.Update(reminder));
 }
        public void ShouldSaveUpdatedItem_WhenItemExists()
        {
            var item    = CreateReminderItem();
            var storage = new ReminderItemStorage(item);

            item.Message = "Another message";
            storage.Update(item);

            var result = storage.Find(item.Id);

            Assert.AreEqual("Another message", result.Message);
        }
        public void ShouldThrowArgumentException_WhenUpdateItemNotExists()
        {
            var storage = new ReminderItemStorage();
            var id      = Guid.NewGuid();

            var exception = Assert.Catch <ArgumentException>(() =>
                                                             storage.Update(
                                                                 CreateReminderItem(id)
                                                                 )
                                                             );

            Assert.IsTrue(exception.Message.Contains(id.ToString("N")));
        }
예제 #5
0
        public void WhenUpdateItem_ThenCallFind()
        {
            var reminder = new ReminderItem(Guid.NewGuid()
                                            , "Test1"
                                            , "Reminder1"
                                            , DateTimeOffset.UtcNow
                                            , "UserName1");
            var reminder2 = new ReminderItem(Guid.NewGuid()
                                             , "Test2"
                                             , "Reminder2"
                                             , DateTimeOffset.UtcNow.AddMinutes(-1)
                                             , "UserName2");

            var storage = new ReminderItemStorage(new[] { reminder, reminder2 });

            reminder.Message = "Message2205";
            var exeption = Assert.Catch <ArgumentException>(() => storage.Update(reminder));

            Console.WriteLine(reminder.Message);
            Assert.AreEqual("Message2205", reminder.Message);

            // Assert.AreEqual();
        }
예제 #6
0
 public void WhenUpdateItemIsNull_ShouldThrowArgumentNullException()
 {
     Assert.Catch <ArgumentNullException>(() =>
                                          storage.Update(null)
                                          );
 }