/// <summary> /// Performs the drop operation for a <see cref="RequirementsGroup"/> payload /// </summary> /// <param name="reqSpecPayload"> /// The <see cref="RequirementsGroup"/> that was dropped into this <see cref="RequirementsSpecification"/> /// </param> /// <param name="dropinfo">The <see cref="IDropInfo"/></param> private async Task OnRequirementSpecificationDrop(RequirementsSpecification reqSpecPayload, IDropInfo dropinfo) { var model = (EngineeringModel)this.Thing.TopContainer; var orderPt = OrderHandlerService.GetOrderParameterType(model); if (orderPt == null) { return; } var orderService = new RequirementsSpecificationOrderHandlerService(this.Session, orderPt); var transaction = orderService.Insert(reqSpecPayload, this.Thing, dropinfo.IsDroppedAfter ? InsertKind.InsertAfter : InsertKind.InsertBefore); await this.Session.Write(transaction.FinalizeTransaction()); }
public void TestInsertBeforeWithMissingOrderValue() { var service = new RequirementsSpecificationOrderHandlerService(this.session.Object, this.orderType); var transaction = service.Insert(this.spec1, this.spec3, InsertKind.InsertBefore); var added = transaction.AddedThing.ToList(); var updated = transaction.UpdatedThing.ToList(); Assert.AreEqual(3, added.OfType <RequirementsContainerParameterValue>().Count()); Assert.AreEqual(3, updated.Count); var spec1Clone = (RequirementsSpecification)updated.Single(x => x.Key.Iid == this.spec1.Iid).Value; var orderSpec1 = (RequirementsContainerParameterValue)added.Single(x => spec1Clone.ParameterValue.Contains(x)); var spec3Clone = (RequirementsSpecification)updated.Single(x => x.Key.Iid == this.spec3.Iid).Value; var orderSpec3 = (RequirementsContainerParameterValue)added.Single(x => spec3Clone.ParameterValue.Contains(x)); Assert.IsTrue(int.Parse(orderSpec3.Value[0]) > int.Parse(orderSpec1.Value[0])); }