public void QueryOneTest () { using (var modelContext = new TestModelContext ()) { modelContext.Add<TestEntity> (new TestEntity { Id = 1, Title = "Hello, world!" }); modelContext.Add<TestEntity> (new TestEntity { Id = 2, Title = "Hello again!" }); Assert.Equal (2, modelContext.QueryOne<TestEntity> (e => e.Id == 2).Single ().Id); } }
public void DataRepositoryTest () { var modelContext = new TestModelContext (); modelContext.Query<TestEntity> ().ToList (); modelContext.Dispose (); // repository call after dispose should throw exception Assert.Throws (typeof (InvalidOperationException), () => modelContext.Query<TestEntity> ().ToList ()); }
public void DataRepositoryTest() { var modelContext = new TestModelContext(); modelContext.Query <TestEntity> ().ToList(); modelContext.Dispose(); // repository call after dispose should throw exception Assert.Throws(typeof(InvalidOperationException), () => modelContext.Query <TestEntity> ().ToList()); }
public void QueryOneTest() { using (var modelContext = new TestModelContext()) { modelContext.Add <TestEntity> (new TestEntity { Id = 1, Title = "Hello, world!" }); modelContext.Add <TestEntity> (new TestEntity { Id = 2, Title = "Hello again!" }); Assert.Equal(2, modelContext.QueryWhere <TestEntity> (e => e.Id == 2).Single().Id); } }