Skip to content

Commit 192288a

Browse files
authored
Merge pull request #142 from codingseb/dev
Version 1.4.38.0
2 parents 893f55c + 9563300 commit 192288a

File tree

4 files changed

+170
-41
lines changed

4 files changed

+170
-41
lines changed

CodingSeb.ExpressionEvaluator.Tests/ExpressionEvaluatorTests.cs

+42-2
Original file line numberDiff line numberDiff line change
@@ -1530,6 +1530,46 @@ public static IEnumerable<TestCaseData> TestCasesForExceptionThrowingEvaluation
15301530

15311531
#endregion
15321532

1533+
#region OptionInlineNamespacesEvaluationRule
1534+
1535+
evaluator = new ExpressionEvaluator()
1536+
{
1537+
OptionInlineNamespacesEvaluationRule = InlineNamespacesEvaluationRule.BlockAll
1538+
};
1539+
1540+
yield return new TestCaseData(evaluator, "new System.Collections.Generic.List<string>(){\"-\"}", typeof(ExpressionEvaluatorSyntaxErrorException))
1541+
.SetCategory("Options")
1542+
.SetCategory("InlineNamespacesEvaluationRule.BlockAll")
1543+
.SetCategory("OptionInlineNamespacesEvaluationRule");
1544+
1545+
evaluator = new ExpressionEvaluator()
1546+
{
1547+
OptionInlineNamespacesEvaluationRule = InlineNamespacesEvaluationRule.AllowOnlyInlineNamespacesList
1548+
};
1549+
1550+
evaluator.InlineNamespacesList = evaluator.Namespaces.ToList();
1551+
1552+
evaluator.InlineNamespacesList.Remove("System.Collections.Generic");
1553+
1554+
yield return new TestCaseData(evaluator, "new System.Collections.Generic.List<string>()", typeof(ExpressionEvaluatorSyntaxErrorException))
1555+
.SetCategory("Options")
1556+
.SetCategory("InlineNamespacesEvaluationRule.AllowOnlyInlineNamespacesList")
1557+
.SetCategory("OptionInlineNamespacesEvaluationRule");
1558+
1559+
evaluator = new ExpressionEvaluator()
1560+
{
1561+
OptionInlineNamespacesEvaluationRule = InlineNamespacesEvaluationRule.BlockOnlyInlineNamespacesList
1562+
};
1563+
1564+
evaluator.InlineNamespacesList = evaluator.Namespaces.ToList();
1565+
1566+
yield return new TestCaseData(evaluator, "new System.Collections.Generic.List<string>(){ \"\" }", typeof(ExpressionEvaluatorSyntaxErrorException))
1567+
.SetCategory("Options")
1568+
.SetCategory("InlineNamespacesEvaluationRule.BlockOnlyInlineNamespacesList")
1569+
.SetCategory("OptionInlineNamespacesEvaluationRule");
1570+
1571+
#endregion
1572+
15331573
#endregion
15341574

15351575
#region TypesToBlock
@@ -1626,7 +1666,7 @@ public void Evaluate_NewDateTime_When_OptionInlineNamespacesEvaluationActive_is_
16261666
{
16271667
ExpressionEvaluator evaluator = new ExpressionEvaluator()
16281668
{
1629-
OptionInlineNamespacesEvaluationActive = false,
1669+
OptionInlineNamespacesEvaluationRule = InlineNamespacesEvaluationRule.BlockAll,
16301670
};
16311671

16321672
DateTime? dateTime = evaluator.Evaluate<DateTime>("new DateTime(2022,1,20)");
@@ -1649,7 +1689,7 @@ public void Evaluate_NewDateTime_When_OptionInlineNamespacesEvaluationActive_is_
16491689
{
16501690
ExpressionEvaluator evaluator = new ExpressionEvaluator()
16511691
{
1652-
OptionInlineNamespacesEvaluationActive = true,
1692+
OptionInlineNamespacesEvaluationRule = InlineNamespacesEvaluationRule.AllowAll,
16531693
};
16541694

16551695
DateTime? dateTime = evaluator.Evaluate<DateTime>("new DateTime(2022,1,20)");

CodingSeb.ExpressionEvaluator/CodingSeb.ExpressionEvaluator.csproj

+10-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<Product>CodingSeb.ExpressionEvaluator</Product>
66
<Description>A Simple Math and Pseudo C# Expression Evaluator in One C# File. Can also execute small C# like scripts</Description>
77
<Copyright>Copyright © Coding Seb 2017</Copyright>
8-
<Version>1.4.37.0</Version>
9-
<AssemblyVersion>1.4.37.0</AssemblyVersion>
10-
<FileVersion>1.4.37.0</FileVersion>
8+
<Version>1.4.38.0</Version>
9+
<AssemblyVersion>1.4.38.0</AssemblyVersion>
10+
<FileVersion>1.4.38.0</FileVersion>
1111
<OutputPath>bin\$(Configuration)\</OutputPath>
1212
<Authors>Coding Seb</Authors>
1313
<PackageId>CodingSeb.ExpressionEvaluator</PackageId>
@@ -19,7 +19,13 @@
1919
<PackageIconUrl>https://github.com/codingseb/ExpressionEvaluator/blob/master/Icon.png?raw=true</PackageIconUrl>
2020
<PackageIcon>Icon.png</PackageIcon>
2121
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
22-
<PackageReleaseNotes>* Correction of the explicit cast between primitive types and rounding numbers before (int)3.6 -&gt; 4 now (int)3.6 -&gt; 3</PackageReleaseNotes>
22+
<PackageReleaseNotes>* OptionInlineNamespacesEvaluationActive become OptionInlineNamespacesEvaluationRule and allow more possibilities with the addition of InlineNamespacesList
23+
This option can now be one of those :
24+
- InlineNamespacesEvaluationRule.AllowAll
25+
- InlineNamespacesEvaluationRule.AllowOnlyInlineNamespacesList
26+
- InlineNamespacesEvaluationRule.BlockOnlyInlineNamespacesList
27+
- InlineNamespacesEvaluationRule.BlockAll
28+
* Throw better exception and get better exception context with ExceptionDispatchInfo on TargetInvocationException.InnerException and BubbleExceptionContainer</PackageReleaseNotes>
2329
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
2430
<RepositoryUrl>https://github.com/codingseb/ExpressionEvaluator</RepositoryUrl>
2531
<GenerateDocumentationFile>true</GenerateDocumentationFile>

0 commit comments

Comments
 (0)