Skip to content

Commit

Permalink
Updated unit tests after discussion on how it should work.
Browse files Browse the repository at this point in the history
  • Loading branch information
harmen-xb committed Nov 8, 2024
1 parent 281130d commit c109567
Showing 1 changed file with 7 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ Feature: Unit_Config_Model_ModelNamespace
<XGenConfig>
<Model namespaceAware="<namespaceAware>">
<ModelNamespaces>
<ModelNamespace prefix="aa" namespace="http://www.x-breeze.com/a" />
<ModelNamespace prefix="bb" namespace="http://www.x-breeze.com/b" />
<ModelNamespace prefix="xa" namespace="http://www.x-breeze.com/a" />
<ModelNamespace prefix="xb" namespace="http://www.x-breeze.com/b" />
</ModelNamespaces>
</Model>
<TextTemplate rootSectionName="Template">
Expand All @@ -42,39 +42,12 @@ Feature: Unit_Config_Model_ModelNamespace
And an output named "Unit_Config_Model_ModelNodeRemoval.txt" with content:
"""
<expectedResult>
"""

Examples:
| Scenario | namespaceAware | modelXPath | expectedResult |
| Scenario | namespaceAware | modelXPath | expectedResult |
| namespace aware, select without namespace | true | /entities/entity | A -> This is table A |
| namespace aware, select with namespace | true | /entities/xa:entity | B ->This is table B |
| namespace unaware, select with namespace | false | /entities/xa:entity | |

Scenario Outline: Namespace unaware, select without namespace
Given the following config:
"""
<?xml version="1.0" encoding="UTF-8"?>
<XGenConfig>
<Model namespaceAware="false">
<ModelNamespaces>
<ModelNamespace prefix="aa" namespace="http://www.x-breeze.com/a" />
<ModelNamespace prefix="bb" namespace="http://www.x-breeze.com/b" />
</ModelNamespaces>
</Model>
<TextTemplate rootSectionName="Template">
<Output type="single_output" />
</TextTemplate>
<Binding>
<SectionModelBinding section="Template" modelXPath="/entities/entity" placeholderName="table" />
</Binding>
</XGenConfig>
"""
When I run the generator
Then I expect 1 generation result
And an output named "Unit_Config_Model_ModelNodeRemoval.txt" with content:
"""
A -> This is table A
B -> This is table B
C -> This is table C
"""
| namespace aware, select with namespace | true | /entities/xa:entity | B -> This is table B |
| namespace unaware, select with namespace | false | /entities/xa:entity | B -> This is table B |
| namespace unaware, select without namespace | false | /entities/entity | A -> This is table A |

0 comments on commit c109567

Please sign in to comment.