public void sequence_returned_for_object() { HasProperties item = new HasProperties(); Assert.IsNotNull(item.AsSeq()); Assert.AreNotEqual(0, item.AsSeq().Count()); }
public void empty_sequence_returned_for_null() { HasProperties item = null; Assert.IsNotNull(item.AsSeq()); Assert.AreEqual(0, item.AsSeq().Count()); }
public void GeneratesReportOfUnboundParameters() { var target = new HasProperties(); var report = binder.Bind(target, ListWith()); Assert.AreEqual(4, report.PropertiesNotBound.Count); Assert.AreEqual(0, report.PropertiesBound.Count); }
protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options) { base.setJSON(obj, host, options); if (mHasProperties.Count > 0) { obj["HasProperties"] = new JArray(HasProperties.ToList().ConvertAll(x => x.getJson(this, options))); } }
public void DefaultTests(bool preserveSetValue, string propertyName, bool expected) { var finder = new DefaultPropertySelector(preserveSetValue); var instance = new HasProperties(); var property = instance.GetType().GetProperty(propertyName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); Assert.Equal(expected, finder.InjectProperty(property, instance)); }
// Use this for initialization void Start() { HasProperties hp = new HasProperties(); hp.MyFloat = 5f; Debug.Log(hp.MyFloat); Debug.Log(hp.HalfFloat); hp.HalfFloat = 9f; Debug.Log(hp.MyFloat); }
public void sequence_contains_value_of_nullable_struct(long value) { HasProperties item = new HasProperties { OptLong = value }; var pair = item.AsSeq().FirstOrDefault(p => p.Key == nameof(HasProperties.OptLong)); Assert.AreEqual(value, pair.Value); }
public void sequence_contains_value_of_struct(int value) { HasProperties item = new HasProperties { Int1 = value }; var pair = item.AsSeq().First(p => p.Key == nameof(HasProperties.Int1)); Assert.AreEqual(value, pair.Value); }
public void sequence_contains_value_of_class(string value) { HasProperties item = new HasProperties { Text = value }; var pair = item.AsSeq().FirstOrDefault(p => p.Key == nameof(HasProperties.Text)); Assert.AreEqual(value, pair.Value); }
public void GeneratesReportOfBoundParameters() { var target = new HasProperties(); var report = binder.Bind(target, ListWith(PositionalParameter(1, "1"), PositionalParameter(2, "2"), NamedParameter("bim1", "3"), NamedParameter("bim2", "4"))); Assert.AreEqual(0, report.PropertiesNotBound.Count); Assert.AreEqual(4, report.PropertiesBound.Count); }
{ //,IfcCompositeProfileDef ,IfcDerivedProfileDef ,IfcParameterizedProfileDef)); IFC2x3 abstract internal override void parseJObject(JObject obj) { base.parseJObject(obj); JToken token = obj.GetValue("ProfileType", StringComparison.InvariantCultureIgnoreCase); if (token != null) { Enum.TryParse <IfcProfileTypeEnum>(token.Value <string>(), true, out mProfileType); } token = obj.GetValue("ProfileName", StringComparison.InvariantCultureIgnoreCase); if (token != null) { ProfileName = token.Value <string>(); } HasExternalReference.AddRange(mDatabase.extractJArray <IfcExternalReferenceRelationship>(obj.GetValue("HasExternalReference", StringComparison.InvariantCultureIgnoreCase) as JArray)); HasProperties.AddRange(mDatabase.extractJArray <IfcProfileProperties>(obj.GetValue("HasProperties", StringComparison.InvariantCultureIgnoreCase) as JArray)); }
internal override void ParseXml(XmlElement xml) { base.ParseXml(xml); foreach (XmlNode child in xml.ChildNodes) { string name = child.Name; if (string.Compare(name, "HasProperties") == 0) { foreach (XmlNode node in child.ChildNodes) { IfcMaterialProperties p = mDatabase.ParseXml <IfcMaterialProperties>(node as XmlElement); if (p != null) { HasProperties.Add(p); } } } } }
/// <summary> /// Tests the express where-clause specified in param 'clause' /// </summary> /// <param name="clause">The express clause to test</param> /// <returns>true if the clause is satisfied.</returns> public bool ValidateClause(IfcComplexPropertyClause clause) { var retVal = false; try { switch (clause) { case IfcComplexPropertyClause.WR21: retVal = Functions.SIZEOF(HasProperties.Where(temp => Object.ReferenceEquals(this, temp))) == 0; break; case IfcComplexPropertyClause.WR22: retVal = Functions.IfcUniquePropertyName(HasProperties); break; } } catch (Exception ex) { var log = Validation.ValidationLogging.CreateLogger <Xbim.Ifc4.PropertyResource.IfcComplexProperty>(); log?.LogError(string.Format("Exception thrown evaluating where-clause 'IfcComplexProperty.{0}' for #{1}.", clause, EntityLabel), ex); } return(retVal); }
public void sequence_does_not_contain_value_of_nullable_struct() { HasProperties item = new HasProperties(); Assert.IsFalse(item.AsSeq().Contains(p => p.Key == nameof(HasProperties.OptLong))); }
public void sequence_does_not_contain_value_of_null_class() { HasProperties item = new HasProperties(); Assert.IsFalse(item.AsSeq().Contains(p => p.Key == nameof(HasProperties.Text))); }
internal override void parseJObject(JObject obj) { base.parseJObject(obj); HasProperties.AddRange(mDatabase.extractJArray <IfcMaterialProperties>(obj.GetValue("HasProperties", StringComparison.InvariantCultureIgnoreCase) as JArray)); }
protected override void setJSON(JObject obj, BaseClassIfc host, HashSet <int> processed) { base.setJSON(obj, host, processed); obj["HasProperties"] = new JArray(HasProperties.ConvertAll(x => x.getJson(this, processed))); }
public void sequence_contains_pair_for_default_value_of_int() { HasProperties item = new HasProperties(); Assert.IsTrue(item.AsSeq().Contains(p => p.Key == nameof(HasProperties.Int1))); }