sdk-powershell/test/unit/Read-CloudEventData.Tests.ps1

24 lines
715 B
PowerShell

Describe "Read-CloudEventData Function Tests" {
Context "Extracts Data from CloudEvent" {
It 'Reads xml text data' {
# Arrange
$cloudEvent = New-CloudEvent `
-Id ([Guid]::NewGuid()) `
-Type test `
-Source 'urn:test'
$expectedData = '<much wow="xml"/>'
$expectedDataContentType = 'text/xml'
$cloudEvent = $cloudEvent | Add-CloudEventData -Data $expectedData -DataContentType $expectedDataContentType
# Act
$actual = $cloudEvent | Read-CloudEventData
# Assert
$actual | Should -Not -Be $null
$actual | Should -Be $expectedData
}
}
}