public void GetByGuidIdAsJson_WhenTwoItemsExistsAndTheSecondIsQueriedFor_ReturnsTheCorrectItemJson() { var id1 = new Guid("b84f156a-139f-4add-b3d1-25e2b0696268"); var id2 = new Guid("8a2f9a21-d2fa-4eae-82ac-ace6aef34e7d"); var item1 = new GuidItemForGetQueries { Id = id1, SortOrder = 1 }; var item2 = new GuidItemForGetQueries { Id = id2, SortOrder = 2 }; using (var unitOfWork = Database.CreateUnitOfWork()) { unitOfWork.Insert(item1); unitOfWork.Insert(item2); unitOfWork.Commit(); } string itemJsonRefetched; using (var unitOfWork = Database.CreateUnitOfWork()) { itemJsonRefetched = unitOfWork.GetByIdAsJson<GuidItemForGetQueries>(item2.Id); } Assert.AreEqual("{\"Id\":\"8a2f9a21-d2fa-4eae-82ac-ace6aef34e7d\",\"SortOrder\":2}", itemJsonRefetched); }
public void GetByGuidId_WhenTwoItemsExistsAndTheSecondIsQueriedFor_ReturnsTheCorrectItem() { var item1 = new GuidItemForGetQueries { SortOrder = 1 }; var item2 = new GuidItemForGetQueries { SortOrder = 2 }; using (var unitOfWork = Database.CreateUnitOfWork()) { unitOfWork.Insert(item1); unitOfWork.Insert(item2); unitOfWork.Commit(); } GuidItemForGetQueries itemRefetched; using (var unitOfWork = Database.CreateUnitOfWork()) { itemRefetched = unitOfWork.GetById<GuidItemForGetQueries>(item2.Id); } Assert.AreEqual(item2.SortOrder, itemRefetched.SortOrder); }