Updated test for better currency string

This commit is contained in:
jhoneill
2018-08-06 14:21:35 +01:00
parent edab941c44
commit b06a5059c5

View File

@@ -36,10 +36,12 @@ Describe "Number format expansion and setting" {
}
Context "Expand-NumberFormat function" {
It "Expanded named number formats as expected " {
$r = [regex]::Escape([cultureinfo]::CurrentCulture.NumberFormat.CurrencySymbol)
Expand-NumberFormat 'Currency' | Should match "^[$r\(\)\[\]RED0#\?\-;,.]+$"
Expand-NumberFormat 'Number' | Should be "0.00"
Expand-NumberFormat 'Percentage' | Should be "0.00%"
Expand-NumberFormat 'Scientific' | Should be "0.00E+00"
Expand-NumberFormat 'Currency' | Should be ([cultureinfo]::CurrentCulture.NumberFormat.CurrencySymbol + "#,##0.00")
Expand-NumberFormat 'Fraction' | Should be "# ?/?"
Expand-NumberFormat 'Short Date' | Should be "mm-dd-yy"
Expand-NumberFormat 'Short Time' | Should be "h:mm"
@@ -94,8 +96,6 @@ Describe "Number format expansion and setting" {
}
It "Set formats which translate to the correct format ID " {
$ws.Cells[10,1].Style.Numberformat.format | # Set as "Currency"
Should match ("^" + ([regex]::Escape([cultureinfo]::CurrentCulture.NumberFormat.CurrencySymbol)))
$ws.Cells[ 1,1].Style.Numberformat.NumFmtID | Should be 0 # Set as General
$ws.Cells[20,1].Style.Numberformat.NumFmtID | Should be 1 # Set as 0
$ws.Cells[ 2,1].Style.Numberformat.NumFmtID | Should be 2 # Set as "Number"