//Types private static void Compare(DataTypeDesign expected, DataTypeDesign actual) { Assert.AreEqual <bool>(expected.NoArraysAllowed, actual.NoArraysAllowed); Assert.IsFalse(actual.NotInAddressSpace); Compare(expected.Fields, actual.Fields); CompareTypeDesign(expected, actual); }
//internal API internal override NodeDesign Export(List <string> path, Action <InstanceDesign, List <string> > createInstanceType) { DataTypeDesign _new = m_DataTypeDefinitionFactoryBase.Export(); base.Update(_new, path, createInstanceType); return(_new); }
/// <summary> /// Convert to model design /// </summary> /// <param name="types"></param> /// <returns></returns> public static ModelDesign ToModelDesign(this ITypeDictionary types) { var namespaceUri = types.TargetNamespace; if (namespaceUri == "http://opcfoundation.org/UA/Core/") { namespaceUri = Namespaces.OpcUa; } // Convert to node declartions var nodes = new List <NodeDesign>(); foreach (var dataType in types.Items) { var id = new XmlQualifiedName(dataType.Name, namespaceUri); var design = new DataTypeDesign { SymbolicId = id, SymbolicName = id, BaseType = Constants.BaseDataType, NoArraysAllowed = !dataType.AllowArrays, NoClassGeneration = dataType.NotInAddressSpace, NotInAddressSpace = dataType.NotInAddressSpace, IsAbstract = false, Description = dataType.Documentation.ToLocalizedText(), Category = dataType.Category, ReleaseStatus = (Design.Schema.ReleaseStatus)(int) dataType.ReleaseStatus, Purpose = (Design.Schema.DataTypePurpose)(int) dataType.Purpose }; switch (dataType) { case TypeDeclaration simpleType: design.SetDataType(simpleType); nodes.Add(design); break; case ComplexType complexType: design.SetDataType(complexType); nodes.Add(design); break; case ServiceType serviceType: // Not supported break; case EnumeratedType enumeratedType: design.SetDataType(enumeratedType); nodes.Add(design); break; } } return(new ModelDesign { Items = nodes.ToArray(), TargetNamespace = Namespaces.OpcUa, TargetVersion = types.TargetVersion, TargetPublicationDate = types.TargetPublicationDate, TargetPublicationDateSpecified = true, }); }