@@ -35,7 +35,7 @@ namespace Common.Authentication.Test
3535 public class ClientFactoryTests : IDisposable
3636 {
3737 private string subscriptionId ;
38-
38+
3939 private string userAccount ;
4040
4141 private SecureString password ;
@@ -64,8 +64,10 @@ public ClientFactoryTests()
6464 }
6565 password = password . Length == 0 ? null : password ;
6666 runTest = true ;
67+ if ( runTest ) { return ; }
6768 }
6869
70+ #if ! NETSTANDARD
6971 /// <summary>
7072 /// This test run live against Azure to list storage accounts under current subscription.
7173 /// </summary>
@@ -92,17 +94,17 @@ public void VerifyClientFactoryWorks()
9294 account . SetTenants ( "common" ) ;
9395 AzureContext context = new AzureContext
9496 (
95- sub ,
97+ sub ,
9698 account ,
9799 AzureEnvironment . PublicEnvironments [ "AzureCloud" ]
98100 ) ;
99-
101+
100102 // Add registration action to make sure we register for the used provider (if required)
101103 // AzureSession.Instance.ClientFactory.AddAction(new RPRegistrationAction());
102104
103105 // Authenticate!
104106 AzureSession . Instance . AuthenticationFactory . Authenticate ( context . Account , context . Environment , "common" , password , ShowDialog . Always , null ) ;
105-
107+
106108 AzureSession . Instance . ClientFactory . AddUserAgent ( "TestUserAgent" , "1.0" ) ;
107109 // Create the client
108110 var client = AzureSession . Instance . ClientFactory . CreateClient < StorageManagementClient > ( context , AzureEnvironment . Endpoint . ServiceManagement ) ;
@@ -114,6 +116,7 @@ public void VerifyClientFactoryWorks()
114116 Assert . NotNull ( storageAccount ) ;
115117 }
116118 }
119+ #endif
117120
118121 [ Fact ]
119122 [ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
@@ -126,22 +129,27 @@ public void VerifyProductInfoHeaderValueEquality()
126129 factory . AddUserAgent ( "test1" , "456" ) ;
127130 factory . AddUserAgent ( "test3" ) ;
128131 factory . AddUserAgent ( "tesT3" ) ;
129-
132+
130133 Assert . Equal ( 4 , factory . UserAgents . Length ) ;
131- Assert . True ( factory . UserAgents . Any ( u => u . Product . Name == "test1" && u . Product . Version == "123" ) ) ;
132- Assert . True ( factory . UserAgents . Any ( u => u . Product . Name == "test2" && u . Product . Version == "123" ) ) ;
133- Assert . True ( factory . UserAgents . Any ( u => u . Product . Name == "test1" && u . Product . Version == "456" ) ) ;
134- Assert . True ( factory . UserAgents . Any ( u => u . Product . Name == "test3" && u . Product . Version == null ) ) ;
134+ Assert . Contains ( factory . UserAgents , u => u . Product . Name == "test1" && u . Product . Version == "123" ) ;
135+ Assert . Contains ( factory . UserAgents , u => u . Product . Name == "test2" && u . Product . Version == "123" ) ;
136+ Assert . Contains ( factory . UserAgents , u => u . Product . Name == "test1" && u . Product . Version == "456" ) ;
137+ Assert . Contains ( factory . UserAgents , u => u . Product . Name == "test3" && u . Product . Version == null ) ;
135138 }
136139
140+ #if ! NETSTANDARD
137141 public virtual void Dispose ( bool disposing )
138- {
142+ #else
143+ private void Dispose ( bool disposing )
144+ #endif
145+ {
139146 if ( disposing && password != null )
140147 {
141148 password . Dispose ( ) ;
142149 password = null ;
143150 }
144151 }
152+
145153 public void Dispose ( )
146154 {
147155 Dispose ( true ) ;
0 commit comments