public void If_EditableRoot_IsDeleted_Then_Saved_Returns_New_Dirty_Instance_of_Root_That_is_no_longer_marked_Deleted() { var context = GetContext(); var root = new MockEditableRoot(MockEditableRoot.MockEditableRootId, false); root.Saved += (o, e) => { var actual = (MockEditableRoot)e.NewObject; context.Assert.IsNotNull(actual); context.Assert.IsTrue(actual.IsNew); context.Assert.IsTrue(actual.IsDirty); context.Assert.IsFalse(actual.IsDeleted); context.Assert.AreEqual("delete", actual.DataPortalMethod); context.Assert.Success(); }; root.Delete(); //state prior to save() context.Assert.IsFalse(root.IsNew); context.Assert.IsTrue(root.IsDirty); context.Assert.IsTrue(root.IsDeleted); root.BeginSave(); context.Complete(); }
public async Task If_EditableRoot_IsDeleted_Then_Saved_Returns_New_Dirty_Instance_of_Root_That_is_no_longer_marked_Deleted() { var context = GetContext(); var root = new MockEditableRoot(MockEditableRoot.MockEditableRootId, false); root.Delete(); //state prior to save() context.Assert.IsFalse(root.IsNew); context.Assert.IsTrue(root.IsDirty); context.Assert.IsTrue(root.IsDeleted); var actual = await root.SaveAsync(); context.Assert.IsTrue(actual.IsNew); context.Assert.IsTrue(actual.IsDirty); context.Assert.IsFalse(actual.IsDeleted); context.Assert.AreEqual("delete", actual.DataPortalMethod); context.Assert.Success(); context.Complete(); }
public void TestDelete() { UnitTestContext context = GetContext(); MockEditableRoot root = new MockEditableRoot(MockEditableRoot.MockEditableRootId, false); root.Saved += (o, e) => { var actual = (MockEditableRoot)e.NewObject; context.Assert.IsTrue(actual.IsNew); context.Assert.IsTrue(actual.IsDirty); context.Assert.IsFalse(actual.IsDeleted); context.Assert.AreEqual("delete", actual.DataPortalMethod); context.Assert.Success(); }; root.Delete(); #if SILVERLIGHT root.BeginSave((o1, e1) => { context.Assert.IsNull(e1.Error); }); #else root.Save(); #endif context.Complete(); }