public virtual void WriteSimpleCudResult() { CUDResult cudResult = new CUDResult(); String xml = CyclicXmlHandler.Write(cudResult); Assert.AssertEquals(XmlTestConstants.XmlOutput[0], xml, "Wrong xml"); }
public static bool ExceedsMaxOperationDepth(CUDResult opResult) { if (OperationDepth > OperationMaxDepth) { opResult.Errors.Add($"Create, Update or Delete operations have exceeded the max depth of {OperationMaxDepth}."); return(true); } return(false); }
public virtual void ReadWriteSimpleCudResult() { CUDResult cudResult = new CUDResult(); String xml = CyclicXmlHandler.Write(cudResult); Object obj = CyclicXmlHandler.Read(xml); Assert.AssertSame(typeof(CUDResult), obj.GetType(), "Wrong class"); Assert.AssertEquals(XmlTestConstants.XmlOutput[2], xml, "Wrong xml"); }
public void ProcessRead(IPostProcessReader reader) { reader.NextTag(); ICommandTypeRegistry commandTypeRegistry = reader.CommandTypeRegistry; ICommandTypeExtendable commandTypeExtendable = reader.CommandTypeExtendable; commandTypeExtendable.RegisterOverridingCommandType(typeof(MergeArraySetterCommand), typeof(ArraySetterCommand)); Object result = reader.ReadObject(); commandTypeExtendable.UnregisterOverridingCommandType(typeof(MergeArraySetterCommand), typeof(ArraySetterCommand)); if (!(result is CUDResult)) { throw new Exception("Can only handle results of type '" + typeof(CUDResult).Name + "'. Result of type '" + result.GetType().Name + "' given."); } ICommandBuilder commandBuilder = CommandBuilder; Member directObjRefDirectMember = this.directObjRefDirectMember; CUDResult cudResult = (CUDResult)result; IList <IChangeContainer> changes = cudResult.AllChanges; for (int i = 0, size = changes.Count; i < size; i++) { IChangeContainer changeContainer = changes[i]; if (!(changeContainer is CreateContainer)) { continue; } IObjRef ori = changeContainer.Reference; if (ori == null) { continue; } else if (ori is DirectObjRef) { IObjectFuture objectFuture = new ObjRefFuture(ori); IObjectCommand setterCommand = commandBuilder.Build(commandTypeRegistry, objectFuture, ori, directObjRefDirectMember); reader.AddObjectCommand(setterCommand); IObjectCommand mergeCommand = commandBuilder.Build(commandTypeRegistry, objectFuture, changeContainer); reader.AddObjectCommand(mergeCommand); } else { throw new Exception("Not implemented yet"); } } }
private void BtnSave_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(txtHotkeyKey.Text)) { MessageBox.Show("Hotkey is required."); return; } CUDResult result = DataProvider.DataStore.Value.Config.Value.Update(config); if (result.Errors.Any()) { MessageBox.Show(result.ErrorsCombined); } else { this.Close(); } }