55using System . Threading . Tasks ;
66using Azure . AI . MetricsAdvisor . Administration ;
77using Azure . AI . MetricsAdvisor . Models ;
8- using NUnit . Framework ;
98
109namespace Azure . AI . MetricsAdvisor . Tests
1110{
@@ -25,39 +24,35 @@ public class DisposableDetectionConfiguration : IAsyncDisposable
2524 /// Initializes a new instance of the <see cref="DisposableDetectionConfiguration"/> class.
2625 /// </summary>
2726 /// <param name="adminClient">The client to use for deleting the configuration upon disposal.</param>
28- /// <param name="id ">The identifier of the detection configuration this instance is associated with.</param>
29- private DisposableDetectionConfiguration ( MetricsAdvisorAdministrationClient adminClient , string id )
27+ /// <param name="configuration ">The detection configuration this instance is associated with.</param>
28+ private DisposableDetectionConfiguration ( MetricsAdvisorAdministrationClient adminClient , AnomalyDetectionConfiguration configuration )
3029 {
3130 _adminClient = adminClient ;
32- Id = id ;
31+ Configuration = configuration ;
3332 }
3433
3534 /// <summary>
36- /// The identifier of the detection configuration this instance is associated with.
35+ /// The detection configuration this instance is associated with.
3736 /// </summary>
38- public string Id { get ; }
37+ public AnomalyDetectionConfiguration Configuration { get ; }
3938
4039 /// <summary>
4140 /// Creates a detection configuration using the specified <see cref="MetricsAdvisorAdministrationClient"/>.
42- /// A <see cref="DisposableDetectionConfiguration"/> instance is returned, from which the ID of the created
43- /// configuration can be obtained. Upon disposal, the associated configuration will be deleted.
41+ /// A <see cref="DisposableDetectionConfiguration"/> instance is returned, from which the created configuration
42+ /// can be obtained. Upon disposal, the associated configuration will be deleted.
4443 /// </summary>
4544 /// <param name="adminClient">The client to use for creating and for deleting the configuration.</param>
46- /// <param name="hook ">Specifies how the created <see cref="AnomalyDetectionConfiguration"/> should be configured.</param>
47- /// <returns>A <see cref="DisposableDetectionConfiguration"/> instance from which the ID of the created configuration can be obtained.</returns>
48- public static async Task < DisposableDetectionConfiguration > CreateDetectionConfigurationAsync ( MetricsAdvisorAdministrationClient adminClient , AnomalyDetectionConfiguration detectionConfiguration )
45+ /// <param name="configuration ">Specifies how the created <see cref="AnomalyDetectionConfiguration"/> should be configured.</param>
46+ /// <returns>A <see cref="DisposableDetectionConfiguration"/> instance from which the created configuration can be obtained.</returns>
47+ public static async Task < DisposableDetectionConfiguration > CreateDetectionConfigurationAsync ( MetricsAdvisorAdministrationClient adminClient , AnomalyDetectionConfiguration configuration )
4948 {
50- AnomalyDetectionConfiguration createdConfig = await adminClient . CreateDetectionConfigurationAsync ( detectionConfiguration ) ;
51-
52- Assert . That ( createdConfig , Is . Not . Null ) ;
53- Assert . That ( createdConfig . Id , Is . Not . Null . And . Not . Empty ) ;
54-
55- return new DisposableDetectionConfiguration ( adminClient , createdConfig . Id ) ;
49+ AnomalyDetectionConfiguration createdConfig = await adminClient . CreateDetectionConfigurationAsync ( configuration ) ;
50+ return new DisposableDetectionConfiguration ( adminClient , createdConfig ) ;
5651 }
5752
5853 /// <summary>
5954 /// Deletes the configuration this instance is associated with.
6055 /// </summary>
61- public async ValueTask DisposeAsync ( ) => await _adminClient . DeleteDetectionConfigurationAsync ( Id ) ;
56+ public async ValueTask DisposeAsync ( ) => await _adminClient . DeleteDetectionConfigurationAsync ( Configuration . Id ) ;
6257 }
6358}
0 commit comments