public void SaveModifiedEntityTest() { DataProviderBase mockRepos = new MemoryDataProvider(); // load mock data var table = ((MemoryDataProvider)mockRepos).AddTable("mock_table"); PopulateMockTable(table); var myMockEntityQuery = DataModel <MockPoco> .NewQuery() .WhereColumn["string_value"].IsEqualTo("abc"); var entity = mockRepos.LoadModel(myMockEntityQuery); entity.Entity.MockStringValue = "xyz"; entity.Save(); myMockEntityQuery = DataModel <MockPoco> .NewQuery() .WhereColumn["string_value"].IsEqualTo("xyz"); entity = mockRepos.LoadModel(myMockEntityQuery); Assert.IsNotNull(entity); Assert.AreEqual("xyz", entity.Entity.MockStringValue); Assert.IsTrue(entity.DataProvider == mockRepos); }
public void DeleteEntityTest() { DataProviderBase mockRepos = new MemoryDataProvider(); // load mock data var table = ((MemoryDataProvider)mockRepos).AddTable("mock_table"); PopulateMockTable(table); var myMockEntityQuery = DataModel <MockPoco> .NewQuery() .WhereColumn["string_value"].IsEqualTo("abc"); var entity = mockRepos.LoadModel(myMockEntityQuery); entity.MarkDeleted = true; entity.Save(); entity = mockRepos.LoadModel(myMockEntityQuery); Assert.IsNull(entity); }