Skip to content

Commit d24306e

Browse files
committed
add tests for Error message
1 parent 9636d67 commit d24306e

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/ScenarioTests/ManagedCacheTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,12 @@ public void TestManagedCacheNamedCacheDoNotExists()
5050
{
5151
this.RunPowerShellTest("Test-ManagedCacheNamedCacheDoNotExists");
5252
}
53+
54+
[Fact]
55+
[Trait(Category.AcceptanceType, Category.CheckIn)]
56+
public void TestRetirementWarningMessage()
57+
{
58+
this.RunPowerShellTest("Test-RetirementWarningMessage");
59+
}
5360
}
5461
}

src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/ScenarioTests/ManagedCacheTests.ps1

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function Test-ListLocationsSupportCaching
5454
{
5555
$allLocations = Get-AzureManagedCacheLocation
5656

57-
Assert-AreNotEqual 0 $allLocations.Count
57+
Assert-AreNotEqual 0 $allLocations.Count
5858

5959
$found = $FALSE
6060
foreach ($location in $allLocations)
@@ -68,6 +68,30 @@ function Test-ListLocationsSupportCaching
6868
Assert-True {$found}
6969
}
7070

71+
72+
########################## Cache Retirement Warning message test #############################
73+
<#
74+
.SYNOPSIS
75+
List locations that support managed caching service
76+
#>
77+
function Test-RetirementWarningMessage
78+
{
79+
$datetime = Get-Date
80+
$datetime.ToUniversalTime()
81+
$cacheRetired = $datetime -gt "2016-12-01 00:00:00Z"
82+
$allLocations = Get-AzureManagedCacheLocation
83+
$warningText = ""
84+
if($cacheRetired)
85+
{
86+
$warningText = "The Azure Managed Cache Service has been retired as of"
87+
}
88+
else
89+
{
90+
$warningText = "The Azure Managed Cache Service will be retired on"
91+
}
92+
Assert-ThrowsContains {Get-AzureManagedCacheLocation} $warningText
93+
}
94+
7195
########################## Managed Cache (Named cache) Scenario Tests #############################
7296
<#
7397
.SYNOPSIS

0 commit comments

Comments
 (0)