Skip to content

Commit c66ff9b

Browse files
committed
adjustments to unit tests for consistent execution
1 parent 8bc80c6 commit c66ff9b

30 files changed

Lines changed: 512 additions & 408 deletions

Synapse.UnitTests/Core.cs

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -234,32 +234,49 @@ public void MergeParameters_ForEach(string planFile)
234234
}
235235
}
236236

237-
configKeys.Sort();
238-
foreach( int key in configKeys )
239-
actualMergedConfig.AppendLine( configHashes[key] );
240-
parmKeys.Sort();
241-
foreach( int key in parmKeys )
242-
actualMergedParms.AppendLine( parmHashes[key] );
243-
actionKeys.Sort();
244-
foreach( int key in actionKeys )
245-
{
246-
actualMergedActions.AppendLine( actionHashes[key] );
247-
actualMergedActions.AppendLine( "--------------------\r\n" );
248-
}
249-
250237
string type = plan.Actions[0].Parameters.Type.ToString().ToLower();
251238

252239
string expectedMergeConfig = File.ReadAllText( $"{__config}\\{type}_out_dynamic_foreach_plan.{type}" );
253-
//File.WriteAllText( $"{__config}\\{type}_out_dynamic_foreach_plan.{type}", actualMergedConfig.ToString() );
254-
Assert.AreEqual( expectedMergeConfig, actualMergedConfig.ToString() );
240+
string[] expectedConfigs = expectedMergeConfig.Split( new string[] { "\r\n===\r\n" }, StringSplitOptions.RemoveEmptyEntries );
241+
foreach( int key in configKeys )
242+
Assert.IsTrue( expectedConfigs.Contains( configHashes[key] ) );
255243

256244
string expectedMergeParms = File.ReadAllText( $"{__parms}\\{type}_out_dynamic_foreach_plan.{type}" );
257-
//File.WriteAllText( $"{__parms}\\{type}_out_dynamic_foreach_plan.{type}", actualMergedParms.ToString() );
258-
Assert.AreEqual( expectedMergeParms, actualMergedParms.ToString() );
245+
string[] expectedParms = expectedMergeParms.Split( new string[] { "\r\n===\r\n" }, StringSplitOptions.RemoveEmptyEntries );
246+
foreach( int key in parmKeys )
247+
Assert.IsTrue( expectedParms.Contains( parmHashes[key] ) );
259248

260249
string expectedMergeActions = File.ReadAllText( $"{__plansOut}\\parameters_{type}_foreach_out.{type}" );
261-
//File.WriteAllText( $"{__plansOut}\\parameters_{type}_foreach_out.{type}", actualMergedActions.ToString() );
262-
Assert.AreEqual( expectedMergeActions, actualMergedActions.ToString() );
250+
string[] expectedActions = expectedMergeActions.Split( new string[] { "\r\n===\r\n" }, StringSplitOptions.RemoveEmptyEntries );
251+
foreach( int key in actionKeys )
252+
Assert.IsTrue( expectedActions.Contains( actionHashes[key] ) );
253+
254+
255+
//configKeys.Sort();
256+
//foreach( int key in configKeys )
257+
// actualMergedConfig.AppendLine( configHashes[key] );
258+
//parmKeys.Sort();
259+
//foreach( int key in parmKeys )
260+
// actualMergedParms.AppendLine( parmHashes[key] );
261+
//actionKeys.Sort();
262+
//foreach( int key in actionKeys )
263+
//{
264+
// actualMergedActions.AppendLine( actionHashes[key] );
265+
// actualMergedActions.AppendLine( "--------------------\r\n" );
266+
//}
267+
268+
269+
//string expectedMergeConfig = File.ReadAllText( $"{__config}\\{type}_out_dynamic_foreach_plan.{type}" );
270+
////File.WriteAllText( $"{__config}\\{type}_out_dynamic_foreach_plan.{type}", actualMergedConfig.ToString() );
271+
//Assert.AreEqual( expectedMergeConfig, actualMergedConfig.ToString() );
272+
273+
//string expectedMergeParms = File.ReadAllText( $"{__parms}\\{type}_out_dynamic_foreach_plan.{type}" );
274+
////File.WriteAllText( $"{__parms}\\{type}_out_dynamic_foreach_plan.{type}", actualMergedParms.ToString() );
275+
//Assert.AreEqual( expectedMergeParms, actualMergedParms.ToString() );
276+
277+
//string expectedMergeActions = File.ReadAllText( $"{__plansOut}\\parameters_{type}_foreach_out.{type}" );
278+
////File.WriteAllText( $"{__plansOut}\\parameters_{type}_foreach_out.{type}", actualMergedActions.ToString() );
279+
//Assert.AreEqual( expectedMergeActions, actualMergedActions.ToString() );
263280
}
264281

265282
[Test]

Synapse.UnitTests/Plans/Config/json_out_dynamic_foreach_plan.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"CNode3_2": "CValue3_2_inline"
1111
}
1212
}
13+
===
1314
{
1415
"CNode0": "CValue0_dynamic",
1516
"CNode1": "CValue1_forach_1",
@@ -22,6 +23,7 @@
2223
"CNode3_2": "CValue3_2_inline"
2324
}
2425
}
26+
===
2527
{
2628
"CNode0": "CValue0_dynamic",
2729
"CNode1": "CValue1_forach_0",
@@ -34,6 +36,7 @@
3436
"CNode3_2": "CValue3_2_inline"
3537
}
3638
}
39+
===
3740
{
3841
"CNode0": "CValue0_dynamic",
3942
"CNode1": "CValue1_forach_1",
@@ -45,4 +48,4 @@
4548
"CNode3_1": "CValue3_1_dynamic",
4649
"CNode3_2": "CValue3_2_inline"
4750
}
48-
}
51+
}

Synapse.UnitTests/Plans/Config/xml_out_dynamic_foreach_plan.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<CNode3_2>CValue3_2_inline</CNode3_2>
1111
</CNode3>
1212
</CXmlDoc>
13+
===
1314
<CXmlDoc>
1415
<CNode0 CAttr0="CAValue0_file">CValue0_dynamic</CNode0>
1516
<CNode1>CValue1_forach_0</CNode1>
@@ -22,6 +23,7 @@
2223
<CNode3_2>CValue3_2_inline</CNode3_2>
2324
</CNode3>
2425
</CXmlDoc>
26+
===
2527
<CXmlDoc>
2628
<CNode0 CAttr0="CAValue0_file">CValue0_dynamic</CNode0>
2729
<CNode1>CValue1_forach_1</CNode1>
@@ -34,6 +36,7 @@
3436
<CNode3_2>CValue3_2_inline</CNode3_2>
3537
</CNode3>
3638
</CXmlDoc>
39+
===
3740
<CXmlDoc>
3841
<CNode0 CAttr0="CAValue0_file">CValue0_dynamic</CNode0>
3942
<CNode1>CValue1_forach_1</CNode1>
@@ -45,4 +48,4 @@
4548
<CNode3_1 CAttr3_1="CValue3_1_dynamic">CValue3_1_inline</CNode3_1>
4649
<CNode3_2>CValue3_2_inline</CNode3_2>
4750
</CNode3>
48-
</CXmlDoc>
51+
</CXmlDoc>

Synapse.UnitTests/Plans/Config/yaml_out_dynamic_foreach_plan.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CNode3:
77
CNode3_1: CValue3_1_dynamic
88
CNode3_2: CValue3_2_inline
99

10+
===
1011
CNode0: CValue0_dynamic
1112
CNode1: CValue1_forach_0
1213
CNode2:
@@ -16,6 +17,7 @@ CNode3:
1617
CNode3_1: CValue3_1_dynamic
1718
CNode3_2: CValue3_2_inline
1819

20+
===
1921
CNode0: CValue0_dynamic
2022
CNode1: CValue1_forach_1
2123
CNode2:
@@ -25,6 +27,7 @@ CNode3:
2527
CNode3_1: CValue3_1_dynamic
2628
CNode3_2: CValue3_2_inline
2729

30+
===
2831
CNode0: CValue0_dynamic
2932
CNode1: CValue1_forach_0
3033
CNode2:
@@ -33,4 +36,3 @@ CNode2:
3336
CNode3:
3437
CNode3_1: CValue3_1_dynamic
3538
CNode3_2: CValue3_2_inline
36-

Synapse.UnitTests/Plans/Parms/json_out_dynamic_foreach_plan.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"PNode3_2": "PValue3_2_inline"
1111
}
1212
}
13+
===
1314
{
1415
"PNode0": "PValue0_dynamic",
1516
"PNode1": "PValue1_forach_0",
@@ -22,6 +23,7 @@
2223
"PNode3_2": "PValue3_2_inline"
2324
}
2425
}
26+
===
2527
{
2628
"PNode0": "PValue0_dynamic",
2729
"PNode1": "PValue1_forach_1",
@@ -34,6 +36,7 @@
3436
"PNode3_2": "PValue3_2_inline"
3537
}
3638
}
39+
===
3740
{
3841
"PNode0": "PValue0_dynamic",
3942
"PNode1": "PValue1_forach_1",
@@ -45,4 +48,4 @@
4548
"PNode3_1": "PValue3_1_dynamic",
4649
"PNode3_2": "PValue3_2_inline"
4750
}
48-
}
51+
}

Synapse.UnitTests/Plans/Parms/xml_out_dynamic_foreach_plan.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<PNode3_2>PValue3_2_inline</PNode3_2>
1111
</PNode3>
1212
</PXmlDoc>
13+
===
1314
<PXmlDoc>
1415
<PNode0 PAttr0="PAValue0_inline">PValue0_dynamic</PNode0>
1516
<PNode1>PValue1_forach_0</PNode1>
@@ -22,6 +23,7 @@
2223
<PNode3_2>PValue3_2_inline</PNode3_2>
2324
</PNode3>
2425
</PXmlDoc>
26+
===
2527
<PXmlDoc>
2628
<PNode0 PAttr0="PAValue0_inline">PValue0_dynamic</PNode0>
2729
<PNode1>PValue1_forach_1</PNode1>
@@ -34,6 +36,7 @@
3436
<PNode3_2>PValue3_2_inline</PNode3_2>
3537
</PNode3>
3638
</PXmlDoc>
39+
===
3740
<PXmlDoc>
3841
<PNode0 PAttr0="PAValue0_inline">PValue0_dynamic</PNode0>
3942
<PNode1>PValue1_forach_1</PNode1>
@@ -45,4 +48,4 @@
4548
<PNode3_1 PAttr0="PValue3_1_dynamic">PValue3_1_inline</PNode3_1>
4649
<PNode3_2>PValue3_2_inline</PNode3_2>
4750
</PNode3>
48-
</PXmlDoc>
51+
</PXmlDoc>

Synapse.UnitTests/Plans/Parms/yaml_out_dynamic_foreach_plan.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ PNode3:
77
PNode3_1: PValue3_1_dynamic
88
PNode3_2: PValue3_2_inline
99

10+
===
1011
PNode0: PValue0_dynamic
1112
PNode1: PValue1_forach_1
1213
PNode2:
@@ -16,6 +17,7 @@ PNode3:
1617
PNode3_1: PValue3_1_dynamic
1718
PNode3_2: PValue3_2_inline
1819

20+
===
1921
PNode0: PValue0_dynamic
2022
PNode1: PValue1_forach_0
2123
PNode2:
@@ -25,6 +27,7 @@ PNode3:
2527
PNode3_1: PValue3_1_dynamic
2628
PNode3_2: PValue3_2_inline
2729

30+
===
2831
PNode0: PValue0_dynamic
2932
PNode1: PValue1_forach_1
3033
PNode2:
@@ -33,4 +36,3 @@ PNode2:
3336
PNode3:
3437
PNode3_1: PValue3_1_dynamic
3538
PNode3_2: PValue3_2_inline
36-

Synapse.UnitTests/Plans/Plans/RunAs0_out.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,4 @@ StartInfo: {}
140140
Result:
141141
Status: Failed
142142
BranchStatus: Failed
143-
LastModified: 6/30/2018 12:51:40 PM
143+
LastModified: 7/1/2018 2:43:51 AM

Synapse.UnitTests/Plans/Plans/RunAs1_out.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ StartInfo: {}
5454
Result:
5555
Status: Complete
5656
BranchStatus: Complete
57-
LastModified: 6/30/2018 12:51:40 PM
57+
LastModified: 7/1/2018 2:43:51 AM

Synapse.UnitTests/Plans/Plans/RunAs2_out.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ StartInfo: {}
6464
Result:
6565
Status: Complete
6666
BranchStatus: Complete
67-
LastModified: 6/30/2018 12:51:40 PM
67+
LastModified: 7/1/2018 2:43:51 AM

0 commit comments

Comments
 (0)