Skip to content

added tests for primitive types, dictionary type, and enumerable type for convertto-xml#4503

Merged
adityapatwardhan merged 2 commits intoPowerShell:masterfrom
SteveL-MSFT:test-converttoxml
Aug 16, 2017
Merged

added tests for primitive types, dictionary type, and enumerable type for convertto-xml#4503
adityapatwardhan merged 2 commits intoPowerShell:masterfrom
SteveL-MSFT:test-converttoxml

Conversation

@SteveL-MSFT
Copy link
Copy Markdown
Member

Based on https://codecov.io/gh/PowerShell/PowerShell/src/master/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CustomSerialization.cs

Since I'm going to be on vacation, I'm submitting PR now rather than when I finish going through the whole file

$x.Objects.Object."#text" | Should BeExactly $i
}

It "Serialize dictionary type" {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're using terminology from the source code, then I would call this test
"Serialize ContainerType.Dictionary type"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

$x.Objects.Object.Property[1]."#text" | Should BeExactly "bar"
}

It "Serialize enumerable type" {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like above; maybe rename the test to "Serialize ContainerType.Enumerable type"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

$fruit2.name = "banana"
$x = $fruit1,$fruit2 | ConvertTo-Xml
$x.Objects.Object.Count | Should BeExactly 2
$x.Objects.Object[0].Type = "fruit"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this line and below:
Are these assignments ("=") meant to be verifications ( | Should ) ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that's a mistake

Copy link
Copy Markdown
Member

@adityapatwardhan adityapatwardhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix CI errors.

@adityapatwardhan
Copy link
Copy Markdown
Member

CI failing with:

Expected string length 5 but was 27. Strings differ at index 0.
Expected: {fruit}
But was: {<2f125142>..fruit}
-----------^

@SteveL-MSFT
Copy link
Copy Markdown
Member Author

@anmenaga @adityapatwardhan feedback addressed

@adityapatwardhan
Copy link
Copy Markdown
Member

@anmenaga Can you have a look?

@adityapatwardhan adityapatwardhan merged commit feed700 into PowerShell:master Aug 16, 2017
@SteveL-MSFT SteveL-MSFT deleted the test-converttoxml branch August 24, 2017 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants