public void ChildAttributeTest() { Startup.LoadSettings(); // test requirements // service 219 // has Attribute with default rule on Child[MULTIPLE COS SERVICE]. // has MULTIPLE COS SERVICE child relationship in Service Hierarchy var key = new ServiceKey(); key.Id = 219; key.EffectiveDate = DateTime.Now; key.AddValue("CoS Allocation Type", "Multiple COS", PCAT.Common.Models.Attribute.AttributeType.List); key.Children = new Dictionary <string, List <ServiceKey> >(); var child = new ServiceKey() { Id = 228, EffectiveDate = DateTime.Now }; child.AddValue("Test Attribute", "6", AttributeType.SimpleText); key.Children.Add("MULTIPLE COS SERVICE", new List <ServiceKey>() { child }); var results = ServiceAttributes.Get(key, true); }
public void ParentAttributeTest() { Startup.LoadSettings(); // test requirements // service 215 // inherits from 300 with parent attributes GPID and PCATProductID var key = new ServiceKey(); key.Id = 215; key.EffectiveDate = DateTime.Now; key.AddValue("ValueTest", "8", PCAT.Common.Models.Attribute.AttributeType.Integer); key.Relationships = new Dictionary <string, List <ServiceKey> >(); var parent = new ServiceKey() { Id = 212, EffectiveDate = DateTime.Now }; parent.AddValue("GPID", "12345", AttributeType.Integer); parent.AddValue("PCATProductID", "444", AttributeType.Integer); key.ParentServiceKey = parent; var results = ServiceAttributes.Get(key, true); }
public void ReadOnlyRuleAttributeTest() { Startup.LoadSettings(); // test requirements // service 215 // inherits from 300 with parent attributes GPID and PCATProductID var key = new ServiceKey(); key.Id = 234; key.EffectiveDate = DateTime.Now; var parent = new ServiceKey() { Id = 217, EffectiveDate = DateTime.Now }; parent.AddValue("GPID", "12345", AttributeType.Integer); parent.AddValue("PCATProductID", "551", AttributeType.Integer); parent.AddValue("Netflow Data Collection to Customer", "Yes", AttributeType.List); key.ParentServiceKey = parent; var results = ServiceAttributes.Get(key, true); Assert.IsFalse(results.First(a => a.Name.Equals("Port")).ReadOnly); parent.AddValue("Netflow Data Collection to Customer", "No", AttributeType.List); results = ServiceAttributes.Get(key, true); Assert.IsTrue(results.First(a => a.Name.Equals("Netflow Data Collection to Customer")).ReadOnly); }
public void RelatedAttributeTest() { Startup.LoadSettings(); // test requirements // service 215 // has EBGP Remote Peer ASN attribute of type Relationship, with default rule on Relationship[IPVPN] // has IPVPN relationship var key = new ServiceKey(); key.Id = 215; key.EffectiveDate = DateTime.Now; key.AddValue("ValueTest", "8", PCAT.Common.Models.Attribute.AttributeType.Integer); key.Relationships = new Dictionary <string, List <ServiceKey> >(); var ipvpn = new ServiceKey() { Id = 217, EffectiveDate = DateTime.Now }; ipvpn.AddValue("eBGP Remote Peer ASN", "65123", AttributeType.Integer); key.Relationships.Add("IPVPN", new List <ServiceKey>() { ipvpn }); var results = ServiceAttributes.Get(key, true); //int x = 1; }
public ObjectResult Attributes(ServiceAttributesKeyWeb postData) { return(WebFunction.Execute <ServiceAttributesKeyWeb, AttributeInfoWeb[]>(this, postData, (sa) => { AttributeInfoWeb[] list; if (sa == null) { list = new AttributeInfoWeb[1]; list[0] = new AttributeInfoWeb { ErrorString = "Key cannot be null", IsValid = false }; return new WebResult <AttributeInfoWeb[]>(list); } var sKey = new ServiceKey(sa); try { var atts = ServiceAttributes.Get(sKey, sa.PopulateLists); list = new AttributeInfoWeb[atts.Count]; var i = 0; foreach (var att in atts) { list[i++] = new AttributeInfoWeb(att); } } catch (Exception e) { list = new AttributeInfoWeb[1]; list[0] = new AttributeInfoWeb { ErrorString = e.Message, IsValid = false }; } return new WebResult <AttributeInfoWeb[]>(list); })); }