Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 93750dad17 | |||
| c0c0ae8017 |
@@ -495,6 +495,46 @@ namespace VAR.ExpressionEvaluator.Tests
|
|||||||
Assert.False((bool?)result);
|
Assert.False((bool?)result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact()]
|
||||||
|
public void Relations__Var1NullEquals666_EqualsFalse()
|
||||||
|
{
|
||||||
|
EvaluationContext evaluationContex = new EvaluationContext();
|
||||||
|
evaluationContex.SetVariable("v1", null);
|
||||||
|
string expression = "v1 = 666";
|
||||||
|
object result = Parser.EvaluateString(expression, evaluationContex);
|
||||||
|
Assert.False((bool?)result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact()]
|
||||||
|
public void Relations__Var1NullEqualsStringHello_EqualsFalse()
|
||||||
|
{
|
||||||
|
EvaluationContext evaluationContex = new EvaluationContext();
|
||||||
|
evaluationContex.SetVariable("v1", null);
|
||||||
|
string expression = "v1 = \"Hello\"";
|
||||||
|
object result = Parser.EvaluateString(expression, evaluationContex);
|
||||||
|
Assert.False((bool?)result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact()]
|
||||||
|
public void Relations__Var1666Equals666_EqualsFalse()
|
||||||
|
{
|
||||||
|
EvaluationContext evaluationContex = new EvaluationContext();
|
||||||
|
evaluationContex.SetVariable("v1", 666);
|
||||||
|
string expression = "v1 = 666";
|
||||||
|
object result = Parser.EvaluateString(expression, evaluationContex);
|
||||||
|
Assert.True((bool?)result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact()]
|
||||||
|
public void Relations__Var1HelloEqualsStringHello_EqualsFalse()
|
||||||
|
{
|
||||||
|
EvaluationContext evaluationContex = new EvaluationContext();
|
||||||
|
evaluationContex.SetVariable("v1", "Hello");
|
||||||
|
string expression = "v1 = \"Hello\"";
|
||||||
|
object result = Parser.EvaluateString(expression, evaluationContex);
|
||||||
|
Assert.True((bool?)result);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Relations
|
#endregion Relations
|
||||||
|
|
||||||
#region BooleanOps
|
#region BooleanOps
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace VAR.ExpressionEvaluator
|
|||||||
{
|
{
|
||||||
value = ((DateTime)value).ToString("s");
|
value = ((DateTime)value).ToString("s");
|
||||||
}
|
}
|
||||||
if ((value is string) == false && (value is bool) == false)
|
if ((value is string) == false && (value is bool) == false && value != null)
|
||||||
{
|
{
|
||||||
value = Convert.ToDecimal(value);
|
value = Convert.ToDecimal(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,11 @@ namespace VAR.ExpressionEvaluator
|
|||||||
return string.Compare((string)leftValue, (string)rightValue) == 0;
|
return string.Compare((string)leftValue, (string)rightValue) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((leftValue is string && rightValue == null) || (leftValue == null && rightValue is string))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (leftValue is string)
|
if (leftValue is string)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty((string)leftValue))
|
if (string.IsNullOrEmpty((string)leftValue))
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>VAR.ExpressionEvaluator</PackageId>
|
<PackageId>VAR.ExpressionEvaluator</PackageId>
|
||||||
<Title>VAR.ExpressionEvaluator</Title>
|
<Title>VAR.ExpressionEvaluator</Title>
|
||||||
<Version>0.2.3</Version>
|
<Version>0.2.4</Version>
|
||||||
<Description>Expression Evaluation Library</Description>
|
<Description>Expression Evaluation Library</Description>
|
||||||
<Authors>VAR</Authors>
|
<Authors>VAR</Authors>
|
||||||
<Company>VAR</Company>
|
<Company>VAR</Company>
|
||||||
<Copyright>Copyright © VAR 2019-2020</Copyright>
|
<Copyright>Copyright © VAR 2019-2021</Copyright>
|
||||||
<RequireLicenseAcceptance>false</RequireLicenseAcceptance>
|
<RequireLicenseAcceptance>false</RequireLicenseAcceptance>
|
||||||
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
|
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
|
||||||
<PackageProjectUrl>https://github.com/Kableado/VAR.ExpressionEvaluator</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/Kableado/VAR.ExpressionEvaluator</PackageProjectUrl>
|
||||||
@@ -22,9 +22,6 @@
|
|||||||
<Content Include="..\LICENSE.txt" Link="LICENSE.txt" Pack="true" PackagePath="" />
|
<Content Include="..\LICENSE.txt" Link="LICENSE.txt" Pack="true" PackagePath="" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Target Name="CopyPackage" AfterTargets="Pack">
|
<Target Name="CopyPackage" AfterTargets="Pack">
|
||||||
<Copy
|
<Copy SourceFiles="$(OutputPath)..\$(PackageId).$(PackageVersion).nupkg" DestinationFolder="Nuget\" />
|
||||||
SourceFiles="$(OutputPath)..\$(PackageId).$(PackageVersion).nupkg"
|
|
||||||
DestinationFolder="Nuget\"
|
|
||||||
/>
|
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
Reference in New Issue
Block a user