Skip to content

Instantly share code, notes, and snippets.

@bielawb
Created July 12, 2017 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bielawb/71abdd0b381dad68c02972de8ccc5218 to your computer and use it in GitHub Desktop.
Save bielawb/71abdd0b381dad68c02972de8ccc5218 to your computer and use it in GitHub Desktop.
Maskowanie ze zwracaniem obiektów.
$maskowaneObiekty = @(
@{
title = 'Tytuł zamkniętego PRa'
body = 'Opis zamkniętego PRa'
user = @{
login = 'użyszkodnik'
}
state = 'closed'
created_at = (Get-Date -Date 2017-Jan-01).ToUniversalTime().ToString('o') -replace '\.\d+'
closed_at = (Get-Date -Date 2017-Jan-31).ToUniversalTime().ToString('o') -replace '\.\d+'
},
@{
title = 'Tytuł otwartego PRa'
body = 'Opis otwartego PRa'
user = @{
login = 'innyUżyszkodnik'
}
state = 'open'
created_at = (Get-Date -Date 2017-Jan-01).ToUniversalTime().ToString('o') -replace '\.\d+'
closed_at = ''
}
)
$maskujPrzyPomocy = @{
Content = $maskowaneObiekty | ConvertTo-Json
}
Describe 'Zwracanie obiektów z różnymi właściwościami' {
Mock -CommandName Invoke-WebRequest -MockWith {
$maskujPrzyPomocy
}
# Testy...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment