public When_loading_entities_with_include() { dataServiceMock = new Mock <ISimpleParentChildDataService>(); context = new SimpleParentChildDataContext(() => dataServiceMock.Object); dataServiceMock.Setup(x => x.GetChildSet(null, It.IsAny <Query>())) .Returns <ClientInfo, Query>((ci, q) => { var child = new Child { Id = 20, Parent = new Parent { Id = 10 } }; child.AcceptChanges(); child.Parent.AcceptChanges(); return(new QueryResult <Child> { Data = new[] { child } }); }); dataServiceMock.Setup(x => x.GetParentSet(null, It.IsAny <Query>())) .Returns <ClientInfo, Query>((ci, q) => { var parent = new Parent { Id = 10 }; parent.AcceptChanges(); return(new QueryResult <Parent> { Data = new[] { parent } }); }); }
public When_reverting_changes() { context = new SimpleParentChildDataContext(() => default(ISimpleParentChildDataService)); parent = new Parent { Id = 1 }; context.ParentSet.Attach(parent); context.AcceptChanges(); var child1 = new Child { Id = 2 }; var child2 = new Child { Id = 3 }; context.ChildSet.Add(child1); context.ChildSet.Add(child2); parent.Children.Add(child1); parent.Children.Add(child2); }
public When_loading_entities() { dataServiceMock = new Mock <ISimpleParentChildDataService>(); context = new SimpleParentChildDataContext(() => dataServiceMock.Object); parent = new Parent(); child = new Child { Parent = parent }; }
public When_detaching_entities() { context = new SimpleParentChildDataContext(() => default(ISimpleParentChildDataService)); parent = new Parent(); child = new Child { Parent = parent }; parent.AcceptChanges(); child.AcceptChanges(); context.Attach(parent); }