Ejemplo n.º 1
0
        public async Task When_New_EditableRoot_is_Saved_Then_returned_object_isMarked_NotNew_NotDirty()
        {
            var context = GetContext();
            var root    = new MockEditableRoot(MockEditableRoot.MockEditableRootId, true)
            {
                Name = "justin"
            };
            var actual = await root.SaveAsync();

            context.Assert.AreEqual(MockEditableRoot.MockEditableRootId, actual.Id);
            context.Assert.IsFalse(actual.IsNew);
            context.Assert.IsFalse(actual.IsDirty);
            context.Assert.AreEqual("insert", actual.DataPortalMethod);
            context.Assert.Success();

            context.Complete();
        }
Ejemplo n.º 2
0
        public async Task When_EditableRoot_is_Saved_Then_we_receive_an_object_back_that_is_Marked_as_NotNew_NotDirty()
        {
            var context = GetContext();
            var root    = new MockEditableRoot(MockEditableRoot.MockEditableRootId, false);

            root.Name = "justin";

            //State prior to saved
            context.Assert.IsFalse(root.IsNew);
            context.Assert.IsTrue(root.IsDirty);

            var actual = await root.SaveAsync();

            context.Assert.AreEqual(MockEditableRoot.MockEditableRootId, actual.Id);
            context.Assert.IsFalse(actual.IsNew);
            context.Assert.IsFalse(actual.IsDirty);
            context.Assert.AreEqual("update", actual.DataPortalMethod);
            context.Assert.Success();

            context.Complete();
        }
Ejemplo n.º 3
0
        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();
        }