1
+ namespace Atc . Kepware . Configuration . Tests ;
2
+
3
+ public sealed class KepwareConfigurationClientConnectivityTests
4
+ {
5
+ [ Theory ]
6
+ [ InlineData ( "ValidChannelName" , null , null , null , true ) ]
7
+ [ InlineData ( "Invalid.ChannelName" , null , null , null , false ) ]
8
+ [ InlineData ( " InvalidChannelName" , null , null , null , false ) ]
9
+ [ InlineData ( "_ValidChannelName" , null , null , null , false ) ]
10
+ [ InlineData ( "ValidChannelName" , "ValidDeviceName" , null , null , true ) ]
11
+ [ InlineData ( "ValidChannelName" , "Invalid.DeviceName" , null , null , false ) ]
12
+ [ InlineData ( "ValidChannelName" , " InvalidDeviceName" , null , null , false ) ]
13
+ [ InlineData ( "ValidChannelName" , "_ValidDeviceName" , null , null , false ) ]
14
+ [ InlineData ( "ValidChannelName" , "ValidDeviceName" , "ValidTagGroupName" , null , true ) ]
15
+ [ InlineData ( "ValidChannelName" , "ValidDeviceName" , "Invalid.TagGroupName" , null , false ) ]
16
+ [ InlineData ( "ValidChannelName" , "ValidDeviceName" , " InvalidTagGroupName" , null , false ) ]
17
+ [ InlineData ( "ValidChannelName" , "ValidDeviceName" , "_ValidTagGroupName" , null , false ) ]
18
+ [ InlineData ( "ValidChannelName" , "ValidDeviceName" , "ValidTagGroupName" , new [ ] { "ValidTag1" , "ValidTag2" } , true ) ]
19
+ [ InlineData ( "ValidChannelName" , "ValidDeviceName" , "ValidTagGroupName" , new [ ] { "ValidTag1" , "Invalid.Tag2" } , false ) ]
20
+ [ InlineData ( "ValidChannelName" , "ValidDeviceName" , "ValidTagGroupName" , new [ ] { "ValidTag1" , " InvalidTag2" } , false ) ]
21
+ [ InlineData ( "ValidChannelName" , "ValidDeviceName" , "ValidTagGroupName" , new [ ] { "ValidTag1" , "_InvalidTag2" } , false ) ]
22
+ public void IsValidConnectivityName (
23
+ string channelName ,
24
+ string ? deviceName ,
25
+ string ? tagGroupNameOrTagName ,
26
+ string [ ] ? tagGroupStructure ,
27
+ bool expectedIsValid )
28
+ {
29
+ // Arrange
30
+ using var client = new KepwareConfigurationClient ( NullLoggerFactory . Instance ) ;
31
+ var methodInfo = typeof ( KepwareConfigurationClient ) . GetMethod ( "IsValidConnectivityName" , BindingFlags . NonPublic | BindingFlags . Static ) ;
32
+
33
+ // Act
34
+ var parameters = new object [ ] { channelName , deviceName , tagGroupNameOrTagName , tagGroupStructure , null } ;
35
+ var result = ( bool ? ) methodInfo ! . Invoke ( client , parameters ) ?? false ;
36
+
37
+ // Assert
38
+ Assert . Equal ( expectedIsValid , result ) ;
39
+ }
40
+ }
0 commit comments