11using Aml . Engine . CAEX ;
22using Aml . Engine . CAEX . Extensions ;
3- using Aml . Engine . Services ;
43using Microsoft . VisualStudio . TestTools . UnitTesting ;
5- using Opc . Ua ;
6- using System ;
74using System . Collections . Generic ;
8- using System . Linq ;
95
106namespace SystemTest
117{
128 [ TestClass ]
13- public class TestOptionSetEmptyValues
9+ public class TestOptionSet
1410 {
1511 #region Tests
1612
@@ -19,7 +15,7 @@ public void TestOperationalHealthOptionSet()
1915 {
2016 AttributeTypeLibType attributeLibrary = GetFxAcAttributes ( ) ;
2117 AttributeFamilyType attributeFamilyType = attributeLibrary [ "OperationalHealthOptionSet" ] ;
22- TestOptionSet ( attributeFamilyType ) ;
18+ TestOptionSetCount ( attributeFamilyType ) ;
2319 }
2420
2521 [ TestMethod , Timeout ( TestHelper . UnitTestTimeout ) ]
@@ -29,7 +25,7 @@ public void TestAggregatedHealthOptionSet()
2925 AttributeFamilyType attributeFamilyType = attributeLibrary [ "AggregatedHealthDataType" ] ;
3026 Assert . IsNotNull ( attributeFamilyType ) ;
3127 AttributeType attributeType = attributeFamilyType . Attribute [ "AggregatedOperationalHealth" ] ;
32- TestOptionSet ( attributeType ) ;
28+ TestOptionSetCount ( attributeType ) ;
3329 }
3430
3531 [ TestMethod , Timeout ( TestHelper . UnitTestTimeout ) ]
@@ -42,7 +38,7 @@ public void TestInstance()
4238 Assert . IsNotNull ( internalElementType ) ;
4339 AttributeType value = internalElementType . Attribute [ "Value" ] ;
4440 Assert . IsNotNull ( value ) ;
45- TestOptionSet ( value ) ;
41+ TestOptionSetCount ( value ) ;
4642 }
4743
4844 [ TestMethod , Timeout ( TestHelper . UnitTestTimeout ) ]
@@ -75,6 +71,36 @@ public void TestFieldDefinitions(string attributeName, string attributeValue)
7571 Assert . IsNull ( valueAttribute . Attribute [ "ValidBits" ] ) ;
7672 }
7773
74+ [ TestMethod , Timeout ( TestHelper . UnitTestTimeout ) ]
75+ [ DataRow ( "0" , "fr" , "Activer" ) ]
76+ [ DataRow ( "1" , "de" , "Nicht bestätigt" ) ]
77+ [ DataRow ( "2" , "en" , "Unconfirmed" ) ]
78+ public void TestFieldValues ( string index , string localeId , string value )
79+ {
80+ CAEXDocument document = GetDocument ( "TestAml.xml.amlx" ) ;
81+ string amlId = TestHelper . BuildAmlId ( "" , TestHelper . Uris . Test , "3009" ) ;
82+ CAEXObject initialObject = document . FindByID ( amlId ) ;
83+ Assert . IsNotNull ( initialObject , "Unable to find Initial Object" ) ;
84+ AttributeFamilyType theObject = initialObject as AttributeFamilyType ;
85+ Assert . IsNotNull ( theObject , "Unable to Cast Initial Object" ) ;
86+
87+
88+ AttributeType values = GetAttribute ( theObject . Attribute , "OptionSetValues" ) ;
89+ Assert . IsNotNull ( values . AdditionalInformation ) ;
90+ Assert . AreEqual ( 1 , values . AdditionalInformation . Count ) ;
91+ Assert . AreEqual ( "OpcUa:TypeOnly" , values . AdditionalInformation [ 0 ] ) ;
92+
93+ AttributeType nodeIdAttribute = GetAttribute ( values , "NodeId" ) ;
94+ AttributeType rootNodeIdAttribute = GetAttribute ( nodeIdAttribute , "RootNodeId" ) ;
95+ AttributeType numericId = GetAttribute ( rootNodeIdAttribute , "NumericId" ) ;
96+ Assert . AreEqual ( numericId . Value , "6239" ) ;
97+
98+
99+ AttributeType indexAttribute = GetAttribute ( values , index ) ;
100+ AttributeType localeAttribute = GetAttribute ( indexAttribute , localeId ) ;
101+ Assert . AreEqual ( localeAttribute . Value , value ) ;
102+ }
103+
78104
79105
80106 #endregion
@@ -88,7 +114,7 @@ private CAEXDocument GetDocument(string fileName = "AmlFxTest.xml.amlx")
88114 return document ;
89115 }
90116
91- public void TestOptionSet ( AttributeTypeType attributeFamilyType )
117+ public void TestOptionSetCount ( AttributeTypeType attributeFamilyType )
92118 {
93119 Assert . IsNotNull ( attributeFamilyType ) ;
94120 Assert . IsTrue ( attributeFamilyType . Attribute . Count >= 4 ) ;
0 commit comments