public void WhenItemNotExists_ThenFindByIdGivenThrowArgumentException() { var id = Guid.NewGuid(); var exception = Assert.Catch <ArgumentException>(() => storage.Find(id) ); StringAssert.Contains(id.ToString("N"), exception.Message); }
public void GivenItemExists_WhenFind_ThenShouldReturnIt() { var item = CreateReminderItem(); var storage = new ReminderItemStorage(item); var result = storage.Find(item.Id); Assert.AreEqual(item.Id, result.Id); Assert.AreEqual(item.Title, result.Title); Assert.AreEqual(item.Message, result.Message); }
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 WhenItemNotExists_ThenCanFindById() { var storage = new ReminderItemStorage(); var item = CreateReminderItem(); storage.Add(item); var result = storage.Find(item.Id); Assert.NotNull(result); Assert.AreEqual(item.Id, result.Id); Assert.AreEqual(item.Message, result.Message); }
public void WhenItemNotExists_ThenCanFindById() { var storage = new ReminderItemStorage(); var reminder = new ReminderItem[] { new ReminderItem(Guid.NewGuid() , "Test1" , "Reminder1" , DateTimeOffset.UtcNow , "UserName") }; foreach (var items in reminder) { var exeption = Assert.Catch <KeyNotFoundException>(() => storage.Find(items.Id)); } }
public void WhenItemNotExist_ThenCanFindById() { var storage = new ReminderItemStorage(); var item = new ReminderItem( Guid.NewGuid(), "Header", "Message", DateTimeOffset.Now, "UserID"); storage.Add(null); var result = storage.Find(item.Id); Assert.NotNull(result); Assert.AreEqual(item.Id, result.Id); Assert.AreEqual(item.Massege, result.Massege); }
public void Test1() { var factory = new WebApplicationFactory <Startup>(); var storage = new ReminderItemStorage(factory.CreateClient()); var items = new ReminderItem[] { new ReminderItem( Guid.NewGuid() , "Title" , "Message" , DateTimeOffset.UtcNow , "Users" ) }; storage.Add(items); foreach (var item in items) { var result = storage.Find(item.Id); Assert.AreEqual(item.Message, result.Message); } }