@@ -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,25 @@ 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
+ dcMock . Setup ( f => f . NewAsync ( It . Is < DedicatedCircuitNewParameters > ( x => x . Bandwidth == bandwidth &&
106
+ x . CircuitName == circuitName && x . Location == location && x . ServiceProviderName == serviceProviderName ) ,
107
+ It . IsAny < CancellationToken > ( ) ) ) . Returns ( ( DedicatedCircuitNewParameters param , CancellationToken cancellation ) => tNew ) ;
108
+
95
109
dcMock . Setup ( f => f . GetAsync ( It . Is < string > ( sKey => sKey == serviceKey ) , It . IsAny < CancellationToken > ( ) ) ) . Returns ( ( string sKey , CancellationToken cancellation ) => tGet ) ;
110
+
111
+ dcMock . Setup ( f => f . UpdateAsync ( It . Is < string > ( sKey => sKey == serviceKey ) ,
112
+ It . Is < DedicatedCircuitUpdateParameters > ( y => y . Bandwidth == bandwidth . ToString ( ) && y . BillingType == billingType && y . Sku == sku . ToString ( ) ) ,
113
+ It . IsAny < CancellationToken > ( ) ) ) . Returns ( ( string sKey , DedicatedCircuitUpdateParameters updateParam ,
114
+ CancellationToken cancellation ) => tUpdate ) ;
96
115
client . SetupGet ( f => f . DedicatedCircuits ) . Returns ( dcMock . Object ) ;
97
116
98
117
NewAzureDedicatedCircuitCommand cmdlet = new NewAzureDedicatedCircuitCommand ( )
@@ -102,6 +121,7 @@ public void NewAzureDedicatedCircuitSuccessful()
102
121
BillingType = billingType ,
103
122
Location = location ,
104
123
ServiceProviderName = serviceProviderName ,
124
+ Sku = sku ,
105
125
CommandRuntime = mockCommandRuntime ,
106
126
ExpressRouteClient = new ExpressRouteClient ( client . Object )
107
127
} ;
@@ -118,6 +138,28 @@ public void NewAzureDedicatedCircuitSuccessful()
118
138
Assert . Equal ( expected . DedicatedCircuit . ServiceProviderProvisioningState , actual . ServiceProviderProvisioningState ) ;
119
139
Assert . Equal ( expected . DedicatedCircuit . Status , actual . Status ) ;
120
140
Assert . Equal < string > ( expected . DedicatedCircuit . ServiceKey , actual . ServiceKey ) ;
141
+ Assert . Equal < CircuitSku > ( expected . DedicatedCircuit . Sku , actual . Sku ) ;
142
+
143
+ SetAzureDedicatedCircuitPropertiesCommand setCmdlet = new SetAzureDedicatedCircuitPropertiesCommand ( )
144
+ {
145
+ ServiceKey = Guid . Parse ( actual . ServiceKey ) ,
146
+ Bandwidth = bandwidth ,
147
+ BillingType = billingType ,
148
+ Sku = sku ,
149
+ CommandRuntime = mockCommandRuntime ,
150
+ ExpressRouteClient = new ExpressRouteClient ( client . Object )
151
+ } ;
152
+ setCmdlet . ExecuteCmdlet ( ) ;
153
+ actual = mockCommandRuntime . OutputPipeline [ 0 ] as AzureDedicatedCircuit ;
154
+ Assert . Equal < string > ( expected . DedicatedCircuit . CircuitName , actual . CircuitName ) ;
155
+ Assert . Equal < string > ( expected . DedicatedCircuit . BillingType , actual . BillingType ) ;
156
+ Assert . Equal < uint > ( expected . DedicatedCircuit . Bandwidth , actual . Bandwidth ) ;
157
+ Assert . Equal < string > ( expected . DedicatedCircuit . Location , actual . Location ) ;
158
+ Assert . Equal < string > ( expected . DedicatedCircuit . ServiceProviderName , actual . ServiceProviderName ) ;
159
+ Assert . Equal ( expected . DedicatedCircuit . ServiceProviderProvisioningState , actual . ServiceProviderProvisioningState ) ;
160
+ Assert . Equal ( expected . DedicatedCircuit . Status , actual . Status ) ;
161
+ Assert . Equal < string > ( expected . DedicatedCircuit . ServiceKey , actual . ServiceKey ) ;
162
+ Assert . Equal < CircuitSku > ( expected . DedicatedCircuit . Sku , actual . Sku ) ;
121
163
}
122
164
123
165
[ Fact ]
0 commit comments