@@ -56,7 +56,8 @@ public void NewAzureDedicatedCircuitSuccessful()
56
56
string serviceProviderName = "TestProvider" ;
57
57
string location = "us-west" ;
58
58
string serviceKey = "aa28cd19-b10a-41ff-981b-53c6bbf15ead" ;
59
- BillingType billingType = BillingType . UnlimitedData ;
59
+ BillingType billingType = BillingType . MeteredData ;
60
+ CircuitSku sku = CircuitSku . Premium ;
60
61
61
62
MockCommandRuntime mockCommandRuntime = new MockCommandRuntime ( ) ;
62
63
Mock < ExpressRouteManagementClient > client = InitExpressRouteManagementClient ( ) ;
@@ -75,6 +76,7 @@ public void NewAzureDedicatedCircuitSuccessful()
75
76
ServiceKey = serviceKey ,
76
77
ServiceProviderProvisioningState = ProviderProvisioningState . NotProvisioned ,
77
78
Status = DedicatedCircuitState . Enabled ,
79
+ Sku = sku
78
80
} ,
79
81
RequestId = "" ,
80
82
StatusCode = new HttpStatusCode ( )
@@ -91,8 +93,27 @@ public void NewAzureDedicatedCircuitSuccessful()
91
93
var tNew = new Task < ExpressRouteOperationStatusResponse > ( ( ) => expectedStatus ) ;
92
94
tNew . Start ( ) ;
93
95
94
- dcMock . Setup ( f => f . NewAsync ( It . Is < DedicatedCircuitNewParameters > ( x => x . Bandwidth == bandwidth && x . CircuitName == circuitName && x . Location == location && x . ServiceProviderName == serviceProviderName ) , It . IsAny < CancellationToken > ( ) ) ) . Returns ( ( DedicatedCircuitNewParameters param , CancellationToken cancellation ) => tNew ) ;
96
+ ExpressRouteOperationStatusResponse expectedUpdateStatus = new ExpressRouteOperationStatusResponse ( )
97
+ {
98
+ HttpStatusCode = HttpStatusCode . OK ,
99
+ Data = serviceKey
100
+ } ;
101
+
102
+ var tUpdate = new Task < ExpressRouteOperationStatusResponse > ( ( ) => expectedUpdateStatus ) ;
103
+ tUpdate . Start ( ) ;
104
+
105
+ //Task<ExpressRouteOperationStatusResponse> NewAsync(DedicatedCircuitNewParameters parameters, CancellationToken cancellationToken);
106
+ dcMock . Setup ( f => f . NewAsync ( It . Is < DedicatedCircuitNewParameters > ( x => x . Bandwidth == bandwidth && x . CircuitName == circuitName && x . Location == location && x . ServiceProviderName == serviceProviderName ) ,
107
+ It . IsAny < CancellationToken > ( ) ) ) . Returns ( ( DedicatedCircuitNewParameters param , CancellationToken cancellation ) => tNew ) ;
95
108
dcMock . Setup ( f => f . GetAsync ( It . Is < string > ( sKey => sKey == serviceKey ) , It . IsAny < CancellationToken > ( ) ) ) . Returns ( ( string sKey , CancellationToken cancellation ) => tGet ) ;
109
+
110
+ //Task<ExpressRouteOperationStatusResponse> UpdateAsync(string serviceKey, DedicatedCircuitUpdateParameters parameters, CancellationToken cancellationToken);
111
+ // UpdateAsync(this IDedicatedCircuitOperations operations, string serviceKey, DedicatedCircuitUpdateParameters parameters)
112
+
113
+ dcMock . Setup ( f => f . UpdateAsync ( It . Is < string > ( sKey => sKey == serviceKey ) ,
114
+ It . Is < DedicatedCircuitUpdateParameters > ( y => y . Bandwidth == bandwidth . ToString ( ) && y . BillingType == billingType && y . Sku == sku . ToString ( ) ) ,
115
+ It . IsAny < CancellationToken > ( ) ) ) . Returns ( ( string sKey , DedicatedCircuitUpdateParameters updateParam ,
116
+ CancellationToken cancellation ) => tUpdate ) ;
96
117
client . SetupGet ( f => f . DedicatedCircuits ) . Returns ( dcMock . Object ) ;
97
118
98
119
NewAzureDedicatedCircuitCommand cmdlet = new NewAzureDedicatedCircuitCommand ( )
@@ -102,6 +123,7 @@ public void NewAzureDedicatedCircuitSuccessful()
102
123
BillingType = billingType ,
103
124
Location = location ,
104
125
ServiceProviderName = serviceProviderName ,
126
+ Sku = sku ,
105
127
CommandRuntime = mockCommandRuntime ,
106
128
ExpressRouteClient = new ExpressRouteClient ( client . Object )
107
129
} ;
@@ -118,6 +140,28 @@ public void NewAzureDedicatedCircuitSuccessful()
118
140
Assert . Equal ( expected . DedicatedCircuit . ServiceProviderProvisioningState , actual . ServiceProviderProvisioningState ) ;
119
141
Assert . Equal ( expected . DedicatedCircuit . Status , actual . Status ) ;
120
142
Assert . Equal < string > ( expected . DedicatedCircuit . ServiceKey , actual . ServiceKey ) ;
143
+ Assert . Equal < CircuitSku > ( expected . DedicatedCircuit . Sku , actual . Sku ) ;
144
+
145
+ SetAzureDedicatedCircuitPropertiesCommand setCmdlet = new SetAzureDedicatedCircuitPropertiesCommand ( )
146
+ {
147
+ ServiceKey = Guid . Parse ( actual . ServiceKey ) ,
148
+ Bandwidth = bandwidth ,
149
+ BillingType = billingType ,
150
+ Sku = sku ,
151
+ CommandRuntime = mockCommandRuntime ,
152
+ ExpressRouteClient = new ExpressRouteClient ( client . Object )
153
+ } ;
154
+ setCmdlet . ExecuteCmdlet ( ) ;
155
+ actual = mockCommandRuntime . OutputPipeline [ 0 ] as AzureDedicatedCircuit ;
156
+ Assert . Equal < string > ( expected . DedicatedCircuit . CircuitName , actual . CircuitName ) ;
157
+ Assert . Equal < string > ( expected . DedicatedCircuit . BillingType , actual . BillingType ) ;
158
+ Assert . Equal < uint > ( expected . DedicatedCircuit . Bandwidth , actual . Bandwidth ) ;
159
+ Assert . Equal < string > ( expected . DedicatedCircuit . Location , actual . Location ) ;
160
+ Assert . Equal < string > ( expected . DedicatedCircuit . ServiceProviderName , actual . ServiceProviderName ) ;
161
+ Assert . Equal ( expected . DedicatedCircuit . ServiceProviderProvisioningState , actual . ServiceProviderProvisioningState ) ;
162
+ Assert . Equal ( expected . DedicatedCircuit . Status , actual . Status ) ;
163
+ Assert . Equal < string > ( expected . DedicatedCircuit . ServiceKey , actual . ServiceKey ) ;
164
+ Assert . Equal < CircuitSku > ( expected . DedicatedCircuit . Sku , actual . Sku ) ;
121
165
}
122
166
123
167
[ Fact ]
0 commit comments