Skip to content

Commit b94ec22

Browse files
author
Sébastien Geiser
committed
Create Anonymous (Expando)Object
1 parent 804fed9 commit b94ec22

File tree

7 files changed

+221
-95
lines changed

7 files changed

+221
-95
lines changed

CodingSeb.ExpressionEvaluator.Tests/ExpressionEvaluatorScriptEvaluateTests.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,26 @@ public static IEnumerable<TestCaseData> TestCasesForScriptEvaluateTests
11811181
.SetCategory("return")
11821182
.Returns("The result is : 7");
11831183

1184+
yield return new TestCaseData(Resources.Script0051, null, null, null)
1185+
.SetCategory("Script")
1186+
.SetCategory("Init of ExpandoObject")
1187+
.Returns("{\"Hello\":3,\"No\":\"Yes\"}");
1188+
1189+
yield return new TestCaseData(Resources.Script0052, null, null, null)
1190+
.SetCategory("Script")
1191+
.SetCategory("Using already define vars in inits")
1192+
.SetCategory("Init of ExpandoObject")
1193+
.SetCategory("conflict variable assignation vs on the fly in object with same name")
1194+
.Returns("{\"Hello\":3,\"No\":\"Yes\"}");
1195+
1196+
yield return new TestCaseData(Resources.Script0053, null, null, null)
1197+
.SetCategory("Script")
1198+
.SetCategory("Using already define vars in inits")
1199+
.SetCategory("Anonymous type init as ExpandoObject")
1200+
.SetCategory("Init of ExpandoObject")
1201+
.SetCategory("conflict variable assignation vs on the fly in object with same name")
1202+
.Returns("{\"Hello\":3,\"No\":\"Yes\"}");
1203+
11841204
#endregion
11851205

11861206
#region Diactitics
@@ -1278,6 +1298,7 @@ public static IEnumerable<TestCaseData> TestCasesForScriptEvaluateTests
12781298

12791299
yield return new TestCaseData(Resources.Script0049, null, null, null)
12801300
.SetCategory("Script")
1301+
.SetCategory("Conflict between generics and <> operators")
12811302
.SetCategory("variable assignation")
12821303
.SetCategory("Bug")
12831304
.SetCategory("#26")

CodingSeb.ExpressionEvaluator.Tests/Resources.Designer.cs

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CodingSeb.ExpressionEvaluator.Tests/Resources.resx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,4 +268,13 @@
268268
<data name="Script0050" type="System.Resources.ResXFileRef, System.Windows.Forms">
269269
<value>resources\script0050.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
270270
</data>
271+
<data name="Script0051" type="System.Resources.ResXFileRef, System.Windows.Forms">
272+
<value>resources\script0051.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
273+
</data>
274+
<data name="Script0052" type="System.Resources.ResXFileRef, System.Windows.Forms">
275+
<value>resources\script0052.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
276+
</data>
277+
<data name="Script0053" type="System.Resources.ResXFileRef, System.Windows.Forms">
278+
<value>resources\script0053.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
279+
</data>
271280
</root>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* Script0051 */
2+
x = new ExpandoObject()
3+
{
4+
Hello = 3,
5+
No = "Yes"
6+
};
7+
8+
x.Json;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* Script0052 */
2+
3+
Json = "Yes";
4+
y = 3;
5+
6+
x = new ExpandoObject()
7+
{
8+
Hello = y,
9+
No = Json
10+
};
11+
12+
x.Json;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* Script0051 */
2+
x = new
3+
{
4+
Hello = 3,
5+
No = "Yes"
6+
};
7+
8+
x.Json;

0 commit comments

Comments
 (0)