public void NodeIsModified_Reference() { if (ContentType.GetByName("File2") == null) ContentTypeInstaller.InstallContentType(@"<?xml version=""1.0"" encoding=""utf-8""?> <ContentType name=""File2"" parentType=""File"" handler=""SenseNet.ContentRepository.File"" xmlns=""http://schemas.sensenet.com/SenseNet/ContentRepository/ContentTypeDefinition""> <DisplayName>Folder</DisplayName> <Description>Use folders to group information to one place</Description> <Icon>Folder</Icon> <Fields> <Field name=""References"" type=""Reference"" /> </Fields> </ContentType>"); //int rootId = TestRoot.Id; //int file2ctId = ContentType.GetByName("File2").Id; var REFS = "References"; var node1 = Node.LoadNode(1); var node2 = Node.LoadNode(2); var node3 = Node.LoadNode(3); var node4 = Node.LoadNode(4); var node5 = Node.LoadNode(5); var node6 = Node.LoadNode(6); var node = new File(TestRoot, "File2"); node.SetReferences(REFS, new Node[] { node1, node2 }); // 1, 2 node.Save(); node = Node.Load<File>(node.Id); bool changed0 = node.IsModified; // false node.AddReference(REFS, node3); // 1, 2, 3 bool changed1 = node.IsModified; // true node.RemoveReference(REFS, node3); // 1, 2 bool changed2 = node.IsModified; // false node.RemoveReference(REFS, node1); // 2 bool changed3 = node.IsModified; // true node.AddReference(REFS, node1); // 2, 1 bool changed4 = node.IsModified; // true node.RemoveReference(REFS, node2); // 1 bool changed5 = node.IsModified; // true node.AddReference(REFS, node2); // 1, 2 bool changed6 = node.IsModified; // false node.SetReferences(REFS, new Node[] { node1, node2 }); // 1, 2 bool changed7 = node.IsModified; // false node.ForceDelete(); Assert.IsFalse(changed0, "#0"); Assert.IsTrue(changed1, "#1"); Assert.IsFalse(changed2, "#2"); Assert.IsTrue(changed3, "#3"); Assert.IsTrue(changed4, "#4"); Assert.IsTrue(changed5, "#5"); Assert.IsFalse(changed6, "#6"); Assert.IsFalse(changed7, "#7"); }