public void TestGet() { ITechnobabble service = new TechnobabbleService(); var list = service.GetCollection(); foreach (var x in list) { SampleItem item = service.Get(x.Id); Assert.AreEqual(item.Id, x.Id); } }
public void TestUpdate() { ITechnobabble service = new TechnobabbleService(); var initialList = service.GetCollection(); foreach (var originalItem in initialList) { SampleItem item = service.Get(originalItem.Id); item.StringValue = "Updated from" + item.StringValue; SampleItem newItem = service.Update(item.Id, item); Assert.AreEqual(item, newItem); var updatedList = service.GetCollection(); SampleItem updateItemFromCollection = (from temp in updatedList where temp.Id == item.Id select temp).First(); Assert.AreEqual(updateItemFromCollection.Id, newItem.Id); Assert.AreEqual(updateItemFromCollection.StringValue, newItem.StringValue); } }
public void TestDelete() { ITechnobabble service = new TechnobabbleService(); var list = service.GetCollection(); foreach (var x in list) { SampleItem item = service.Get(x.Id); service.Delete(item.Id); var updatedList = service.GetCollection(); Assert.IsFalse(updatedList.Contains(item)); try { //now get shall fail service.Get(item.Id); } catch (Exception) { continue; } //should not reach this code Assert.Fail(); } }
public void TestGetCollection() { ITechnobabble service = new TechnobabbleService(); var list = service.GetCollection(); Assert.IsTrue(list.Count > 0); }