public void ServiceBuildChild() { //Assumes that service Id 227 has children tha are available when product id is 570 Startup.LoadSettings(); var key = new BuildChildServiceRequestWeb(); var parent = new ServiceKeyWeb(); parent.ServiceID = 227; parent.Date = DateTime.Now; parent.Attributes = new AttributeInstanceWeb[1]; var attr = new AttributeInstanceWeb(); attr.Name = "PCATProductID"; attr.Type = "Text"; var value = new AttributeChoiceWeb(); value.Value = "570"; attr.Value = value; parent.Attributes[0] = attr; parent.ChildServices = new ServiceNamedCollectionWeb[0]; parent.IsValid = true; key.ParentService = parent; key.Name = "LAN PORT SERVICE"; var url = FscApplication.Current.Settings.FscUrls.FSCMediation + MediationEndPoints.serviceBuildChild; var hierarchy = ApiClient.Post <ServiceKeyWeb, BuildChildServiceRequestWeb> (HttpTargetType.FSCMediation, "FSC Mediation Serv Build child", url, key, ApiClient.ContentType.Json, ApiClient.HeaderType.FSCMediation); Assert.IsNotNull(hierarchy); Assert.IsTrue(hierarchy.Attributes.Length > 0); }
public ObjectResult BuildChild(BuildChildServiceRequestWeb postData) { return(WebFunction.Execute <BuildChildServiceRequestWeb, ServiceKeyWeb>(this, postData, (req) => { var key = new ServiceKey(req.ParentService); var child = ServiceHierarchy.BuildChild(key, req.Name); return new WebResult <ServiceKeyWeb>(child.ToWeb()); })); }