File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Common/Commands.Common/Extensions
ResourceManager/Profile/Commands.Profile.Test Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 12
12
// limitations under the License.
13
13
// ----------------------------------------------------------------------------------
14
14
15
+ using Microsoft . WindowsAzure . Commands . Common ;
15
16
using System ;
16
17
using System . Collections . Generic ;
17
18
using System . Collections . ObjectModel ;
@@ -216,6 +217,18 @@ public static void InvokeEndProcessing(this PSCmdlet cmdlt)
216
217
dynMethod . Invoke ( cmdlt , null ) ;
217
218
}
218
219
220
+ public static void EnableDataCollection ( this AzurePSCmdlet cmdlt )
221
+ {
222
+ FieldInfo dynField = ( typeof ( AzurePSCmdlet ) ) . GetField ( "_dataCollectionProfile" , BindingFlags . NonPublic | BindingFlags . Static ) ;
223
+ dynField . SetValue ( cmdlt , new AzurePSDataCollectionProfile ( true ) ) ;
224
+ }
225
+
226
+ public static void DisableDataCollection ( this AzurePSCmdlet cmdlt )
227
+ {
228
+ FieldInfo dynField = ( typeof ( AzurePSCmdlet ) ) . GetField ( "_dataCollectionProfile" , BindingFlags . NonPublic | BindingFlags . Static ) ;
229
+ dynField . SetValue ( cmdlt , new AzurePSDataCollectionProfile ( false ) ) ;
230
+ }
231
+
219
232
#endregion
220
233
}
221
234
}
Original file line number Diff line number Diff line change @@ -44,7 +44,6 @@ public ContextCmdletTests(ITestOutputHelper output)
44
44
AzureSession . Instance . DataStore = dataStore ;
45
45
commandRuntimeMock = new MockCommandRuntime ( ) ;
46
46
AzureSession . Instance . AuthenticationFactory = new MockTokenAuthenticationFactory ( ) ;
47
- Environment . SetEnvironmentVariable ( AzurePSDataCollectionProfile . EnvironmentVariableName , "false" ) ;
48
47
}
49
48
50
49
[ Fact ]
@@ -75,6 +74,7 @@ public void GetAzureContextNoLogin()
75
74
76
75
// Setup
77
76
cmdlt . CommandRuntime = commandRuntimeMock ;
77
+ cmdlt . DisableDataCollection ( ) ;
78
78
var profile = AzureRmProfileProvider . Instance . Profile ;
79
79
AzureRmProfileProvider . Instance . Profile = new AzureRmProfile ( ) ;
80
80
You can’t perform that action at this time.
0 commit comments