Skip to content

Commit

Permalink
Issue #10 - When adding more than one method to a class, New-OdataEnd…
Browse files Browse the repository at this point in the history
…point does not create the right xml
  • Loading branch information
toenuff committed Apr 20, 2014
1 parent 7cd63c6 commit e82bae9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Odata.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function ConvertTo-ClassXML{
} else {
$section = $verb
}
$text += " "*10 + ("<{0}>`r`n" -f $section)
$text += " "*8 + ("<{0}>`r`n" -f $section)
$text += " "*10 + ("<Cmdlet>{0}</Cmdlet>`r`n" -f $class.($verb).Cmdlet)
$text += $verbtext -f $section, $class.($verb).Cmdlet

Expand Down Expand Up @@ -187,9 +187,9 @@ function ConvertTo-ClassXML{
$paramtext += " "*10 + "</ParameterSets>`r`n"
$text += $paramtext
}
$text += " "*8 + "</$section>`r`n"
}
}
$text += " "*8 + "</$section>`r`n"
$text += @"
</CmdletImplementation>
</Class>
Expand Down
27 changes: 24 additions & 3 deletions tests/Odata.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Describe "Add-OdataMethod" {
$class.update|should BeNullOrEmpty
}
It "Creates a DELETE method" {
#$class |set-odatamethod -verb delete -cmdlet stop-process
$class |set-odatamethod -verb delete -cmdlet stop-process -FilterParams ID -params ID
}
It "Fails if verb is not valid" {
{$class |set-odatamethod -verb blah -cmdlet dir -pk ID -Params Name, ID -FilterParams Name} |should Throw
Expand Down Expand Up @@ -77,7 +77,7 @@ Describe "ConvertTo-ClassXML" {
<Class>
<Name>mosd_Process</Name>
<CmdletImplementation>
<Query>
<Query>
<Cmdlet>get-process</Cmdlet>
<Options>
<ParameterName>Name</ParameterName>
Expand All @@ -103,6 +103,27 @@ Describe "ConvertTo-ClassXML" {
</ParameterSet>
</ParameterSets>
</Query>
<Delete>
<Cmdlet>stop-process</Cmdlet>
<Options>
<ParameterName>ID</ParameterName>
</Options>
<FieldParameterMap>
<Field>
<FieldName>ID</FieldName>
<ParameterName>ID</ParameterName>
</Field>
</FieldParameterMap>
<ParameterSets>
<ParameterSet>
<Name>Default</Name>
<Parameter>
<Name>ID</Name>
<Type>System.String[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</Type>
</Parameter>
</ParameterSet>
</ParameterSets>
</Delete>
</CmdletImplementation>
</Class>
Expand Down Expand Up @@ -141,9 +162,9 @@ Describe "New-OdataEndpoint" {
"@
}
# need validator for schema.xml
}

# cleanup the directory created during the tests
rm (join-path $here odata) -recurse

#TODO consider moving validation text into validator files in the /tests directory

0 comments on commit e82bae9

Please sign in to comment.