Skip to content

Commit

Permalink
Rename Get-ClassResourcePropertyState2 to Get-ClassResourcePropertyType
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-hughes committed Nov 17, 2024
1 parent b56de0f commit fb5aa9f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
by parameter `RemoveTopLevelHeader` in the task, which defaults to `$true`.
- Added Helper functions as part of [#163] (https://github.com/dsccommunity/DscResource.DocGenerator/pull/163).
- `Get-ClassPropertyCustomAttribute`
- `Get-ClassResourcePropertyState2`
- `Get-ClassResourcePropertyType`
- `Get-DscPropertyType`
- `Test-ClassPropertyDscAttributeArgument`

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<#
.SYNOPSIS
This function returns the property state value of an class-based DSC
This function returns the property type of a class-based DSC
resource property.
.DESCRIPTION
This function returns the property state value of an DSC class-based
This function returns the property type value of a DSC class-based
resource property.
.PARAMETER PropertyInfo
The PropertyInfo of a class-based DSC resource property.
The PropertyInfo object of a class-based DSC resource property.
.EXAMPLE
Get-ClassResourcePropertyState2 -PropertyInfo $properties
Get-ClassResourcePropertyType -PropertyInfo $properties
Returns the property state for the property 'KeyName'.
#>
function Get-ClassResourcePropertyState2
function Get-ClassResourcePropertyType
{
[CmdletBinding()]
[OutputType([System.String])]
Expand All @@ -37,20 +37,20 @@ function Get-ClassResourcePropertyState2

if ((Test-ClassPropertyDscAttributeArgument -IsKey @attributeParams))
{
$propertyState = 'Key'
$propertyType = 'Key'
}
elseif ((Test-ClassPropertyDscAttributeArgument -IsMandatory @attributeParams))
{
$propertyState = 'Required'
$propertyType = 'Required'
}
elseif ((Test-ClassPropertyDscAttributeArgument -IsRead @attributeParams))
{
$propertyState = 'Read'
$propertyType = 'Read'
}
elseif ((Test-ClassPropertyDscAttributeArgument -IsWrite @attributeParams))
{
$propertyState = 'Write'
$propertyType = 'Write'
}

return $propertyState
return $propertyType
}
2 changes: 1 addition & 1 deletion source/Private/Get-ClassResourceProperty.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function Get-ClassResourceProperty
IsArray = $false
}

$propertyAttribute.State = Get-ClassResourcePropertyState2 -PropertyInfo $propertyMember
$propertyAttribute.State = Get-ClassResourcePropertyType -PropertyInfo $propertyMember

$valueMapValues = $null
if ($propertyMember.PropertyType.IsEnum)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Import-Module $script:moduleName -Force -ErrorAction 'Stop'
#endregion HEADER

InModuleScope $script:moduleName {
Describe 'Get-ClassResourcePropertyState' {
Describe 'Get-ClassResourcePropertyType' {
Context 'When a property have the named attribute argument ''Key''' {
BeforeAll {
$mockClassBasedScript = {
Expand Down Expand Up @@ -51,7 +51,7 @@ InModuleScope $script:moduleName {
}

It 'Should return the state as ''Key''' {
$result = Get-ClassResourcePropertyState2 -PropertyInfo $mockProperties[0] -Verbose
$result = Get-ClassResourcePropertyType -PropertyInfo $mockProperties[0] -Verbose

$result | Should -Be 'Key'
}
Expand Down Expand Up @@ -92,7 +92,7 @@ InModuleScope $script:moduleName {

It 'Should return the state as ''Write''' {
# Makes sure to test the second property (since Key is always needed)
$result = Get-ClassResourcePropertyState2 -PropertyInfo $mockProperties[1] -Verbose
$result = Get-ClassResourcePropertyType -PropertyInfo $mockProperties[1] -Verbose

$result | Should -Be 'Write'
}
Expand Down Expand Up @@ -133,7 +133,7 @@ InModuleScope $script:moduleName {

It 'Should return the state as ''Required''' {
# Makes sure to test the second property (since Key is always needed)
$result = Get-ClassResourcePropertyState2 -PropertyInfo $mockProperties[1] -Verbose
$result = Get-ClassResourcePropertyType -PropertyInfo $mockProperties[1] -Verbose

$result | Should -Be 'Required'
}
Expand Down Expand Up @@ -174,7 +174,7 @@ InModuleScope $script:moduleName {

It 'Should return the state as ''Read''' {
# Makes sure to test the second property (since Key is always needed)
$result = Get-ClassResourcePropertyState2 -PropertyInfo $mockProperties[1] -Verbose
$result = Get-ClassResourcePropertyType -PropertyInfo $mockProperties[1] -Verbose

$result | Should -Be 'Read'
}
Expand Down

0 comments on commit fb5aa9f

Please sign in to comment.