public void UpdateParentsTest() { var context = creator.context; var form = creator.form; var newForms = Forms.CreateMore(mockContext); TestBase.CalcVirtualAttributes(context); Func <Form, bool> allow = (f => true); var input = new FForm { ParentIds = new int[] { newForms[0].Id, newForms[1].Id } }; FormsServices <Form, OForm> .Update(context, form.Id, input, allow); form = Form.Load(context, form.Id); CollectionAssert.AreEqual(input.ParentIds, form.Parents.Select(p => p.Id).ToArray()); input = new FForm { ParentIds = new int[] { newForms[1].Id, newForms[2].Id } }; FormsServices <Form, OForm> .Update(context, form.Id, input, allow); form = Form.Load(context, form.Id); CollectionAssert.AreEqual(input.ParentIds, form.Parents.Select(p => p.Id).ToArray()); input = new FForm { ParentIds = new int[] { newForms[0].Id, newForms[1].Id } }; FormsServices <Form, OForm> .Update(context, form.Id, input, allow); form = Form.Load(context, form.Id); CollectionAssert.AreEquivalent(input.ParentIds, form.Parents.Select(p => p.Id).ToArray()); }