Skip to content

Commit cf04e6f

Browse files
author
Ajit Navasare (MINDTREE LIMITED)
committed
Updated the test
1 parent 92bdd91 commit cf04e6f

File tree

4 files changed

+22
-42
lines changed

4 files changed

+22
-42
lines changed

src/ResourceManager/EventHub/Commands.EventHub.Test/ScenarioTests/ConsumerGroupsTests.ps1

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,14 @@ function ConsumerGroupsTests
7676
Assert-True {$createdNamespace.Count -eq 1}
7777

7878
$found = 0
79-
for ($i = 0; $i -lt $createdNamespace.Count; $i++)
80-
{
81-
if ($createdNamespace[$i].Name -eq $namespaceName)
79+
80+
if ($createdNamespace.Name -eq $namespaceName)
8281
{
8382
$found = 1
84-
Assert-AreEqual $location $createdNamespace[$i].Location
85-
Assert-AreEqual $resourceGroupName $createdNamespace[$i].ResourceGroupName
86-
Assert-AreEqual "EventHub" $createdNamespace[$i].NamespaceType
83+
Assert-AreEqual $location $createdNamespace.Location
8784
break
8885
}
89-
}
86+
9087

9188
Assert-True {$found -eq 0} "Namespace created earlier is not found."
9289

src/ResourceManager/EventHub/Commands.EventHub.Test/ScenarioTests/EventHubsTests.ps1

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,16 @@ function EventHubsTests
8787
Assert-True {$createdNamespace.Count -eq 1}
8888

8989
$found = 0
90-
for ($i = 0; $i -lt $createdNamespace.Count; $i++)
91-
{
92-
if ($createdNamespace[$i].Name -eq $namespaceName)
90+
91+
if ($createdNamespace.Name -eq $namespaceName)
9392
{
9493
$found = 1
95-
Assert-AreEqual $location $createdNamespace[$i].Location
96-
Assert-AreEqual $resourceGroupName $createdNamespace[$i].ResourceGroupName
97-
Assert-AreEqual "EventHub" $createdNamespace[$i].NamespaceType
94+
Assert-AreEqual $location $createdNamespace.Location
9895
break
9996
}
100-
}
97+
10198
Assert-True {$found -eq 0} "Namespace created earlier is not found."
10299

103-
104100
# Create a EventHub
105101
Write-Debug " Create new eventHub "
106102
$msgRetentionInDays = 3
@@ -123,7 +119,7 @@ function EventHubsTests
123119
$found = 0
124120
for ($i = 0; $i -lt $createdEventHubList.Count; $i++)
125121
{
126-
if ($createdEventHubList[$i].Name -eq $createdEventHub)
122+
if ($createdEventHubList[$i].Name -eq $createdEventHub.Name)
127123
{
128124
$found = $found + 1
129125
}
@@ -190,17 +186,13 @@ function EventHubsAuthTests
190186
# Assert
191187
Assert-True {$createdNamespace.Count -eq 1}
192188
$found = 0
193-
for ($i = 0; $i -lt $createdNamespace.Count; $i++)
194-
{
195-
if ($createdNamespace[$i].Name -eq $namespaceName)
189+
190+
if ($createdNamespace.Name -eq $namespaceName)
196191
{
197192
$found = 1
198-
Assert-AreEqual $location $createdNamespace[$i].Location
199-
Assert-AreEqual $resourceGroupName $createdNamespace[$i].ResourceGroupName
200-
Assert-AreEqual "EventHub" $createdNamespace[$i].NamespaceType
193+
Assert-AreEqual $location $createdNamespace.Location
201194
break
202195
}
203-
}
204196

205197
# Assert
206198
Assert-True {$found -eq 0} "Namespace created earlier is not found."

src/ResourceManager/EventHub/Commands.EventHub.Test/ScenarioTests/NamespaceTests.ps1

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,13 @@ function NamespaceAuthTests
7676
Assert-True {$createdNamespace.Count -eq 1}
7777

7878
$found = 0
79-
for ($i = 0; $i -lt $createdNamespace.Count; $i++)
80-
{
81-
if ($createdNamespace[$i].Name -eq $namespaceName)
79+
80+
if ($createdNamespace.Name -eq $namespaceName)
8281
{
8382
$found = 1
84-
Assert-AreEqual $location $createdNamespace[$i].Location
85-
Assert-AreEqual $resourceGroupName $createdNamespace[$i].ResourceGroupName
83+
Assert-AreEqual $location $createdNamespace.Location
8684
break
8785
}
88-
}
8986

9087
Assert-True {$found -eq 0} "Namespace created earlier is not found."
9188

@@ -231,17 +228,13 @@ function NamespaceTests
231228
Assert-True {$createdNamespace.Count -eq 1}
232229

233230
$found = 0
234-
for ($i = 0; $i -lt $createdNamespace.Count; $i++)
235-
{
236-
if ($createdNamespace[$i].Name -eq $namespaceName)
231+
232+
if ($createdNamespace.Name -eq $namespaceName)
237233
{
238234
$found = 1
239-
Assert-AreEqual $location $createdNamespace[$i].Location
240-
Assert-AreEqual $resourceGroupName $createdNamespace[$i].ResourceGroupName
241-
Assert-AreEqual "EventHub" $createdNamespace[$i].NamespaceType
235+
Assert-AreEqual $location $createdNamespace.Location
242236
break
243237
}
244-
}
245238

246239
Assert-True {$found -eq 0} "Namespace created earlier is not found."
247240

@@ -260,8 +253,6 @@ function NamespaceTests
260253
{
261254
$found = 1
262255
Assert-AreEqual $location $allCreatedNamespace[$i].Location
263-
Assert-AreEqual $secondResourceGroup $allCreatedNamespace[$i].ResourceGroupName
264-
Assert-AreEqual "EventHub" $allCreatedNamespace[$i].NamespaceType
265256
break
266257
}
267258
}
@@ -278,16 +269,12 @@ function NamespaceTests
278269
{
279270
$found = $found + 1
280271
Assert-AreEqual $location $allCreatedNamespace[$i].Location
281-
Assert-AreEqual $resourceGroupName $allCreatedNamespace[$i].ResourceGroupName
282-
Assert-AreEqual "EventHub" $allCreatedNamespace[$i].NamespaceType
283272
}
284273

285274
if ($allCreatedNamespace[$i].Name -eq $namespaceName2)
286275
{
287276
$found = $found + 1
288277
Assert-AreEqual $location $allCreatedNamespace[$i].Location
289-
Assert-AreEqual $secondResourceGroup $allCreatedNamespace[$i].ResourceGroupName
290-
Assert-AreEqual "EventHub" $allCreatedNamespace[$i].NamespaceType
291278
}
292279
}
293280

src/ResourceManager/EventHub/Commands.EventHub/Commands.EventHub.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@
153153
<None Include="..\AzureRM.EventHub.psd1">
154154
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
155155
</None>
156+
<None Include="app.config" />
157+
<None Include="Microsoft.Azure.Commands.EventHub.format.ps1xml">
158+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
159+
</None>
156160
<None Include="MSSharedLibKey.snk" />
157161
<None Include="packages.config">
158162
<SubType>Designer</SubType>

0 commit comments

Comments
 (0)