Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Handle expressions like 'a = x + y', adjust UnitTest's

  • Loading branch information...
commit 1324b33b00a1db2211dc1b5ee771fea934515d07 1 parent 4c9c7a0
@PeterForstmeier PeterForstmeier authored
Showing with 268 additions and 253 deletions.
  1. +1 −0  src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/ICSharpCode.Reports.Core.csproj
  2. +1 −1  src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/BasePager.cs
  3. +20 −24 src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Expressions/EvaluationHelper.cs
  4. +46 −3 src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Expressions/ExpressionEvaluatorFacade.cs
  5. +1 −0  src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Expressions/IExpressionEvaluatorFacade.cs
  6. +17 −1 ...ns/Misc/Reports/ICSharpCode.Reports.Core/Project/Expressions/ReportingLanguage/ReportingLanguageCompiler.cs
  7. +142 −0 src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Globals/StringHelpers.cs
  8. +0 −135 src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Xml/MycroParser.cs
  9. +0 −1  ...sc/Reports/ICSharpCode.Reports.Core/Test/ICSharpCode.Reports.Core.Test/ICSharpCode.Reports.Core.Test.csproj
  10. +24 −0 ...ICSharpCode.Reports.Core/Test/ICSharpCode.Reports.Core.Test/ReportingLanguage/ExpressionEvaluatorFixture.cs
  11. +1 −12 ...rts.Core/Test/ICSharpCode.Reports.Core.Test/ReportingLanguage/IntegrationTests/AggregateFunctionsFixture.cs
  12. +7 −15 ...e.Reports.Core/Test/ICSharpCode.Reports.Core.Test/ReportingLanguage/IntegrationTests/ConcatFieldsFixture.cs
  13. +0 −46 ...Reports.Core/Test/ICSharpCode.Reports.Core.Test/ReportingLanguage/IntegrationTests/FieldReferenceFixture.cs
  14. +1 −8 ...Reports.Core/Test/ICSharpCode.Reports.Core.Test/ReportingLanguage/IntegrationTests/SimpleCompilerFixture.cs
  15. +2 −2 ....Reports.Core/Test/ICSharpCode.Reports.Core.Test/ReportingLanguage/IntegrationTests/UserFunctionsFixture.cs
  16. +5 −5 ...eports.Core/Test/ICSharpCode.Reports.Core.Test/ReportingLanguage/LanguageTests/AggregateFunctionsFixture.cs
View
1  src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/ICSharpCode.Reports.Core.csproj
@@ -292,6 +292,7 @@
<Compile Include="Project\Globals\GraphicsUnit.cs" />
<Compile Include="Project\Globals\PdfHelper.cs" />
<Compile Include="Project\Globals\ReportSectionNames.cs" />
+ <Compile Include="Project\Globals\StringHelpers.cs" />
<Compile Include="Project\Globals\UnitConverter.cs" />
<Compile Include="Project\Interfaces\IDataAccessStrategy.cs" />
<Compile Include="Project\Interfaces\IDataViewStrategy.cs" />
View
2  src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Exporter/BasePager.cs
@@ -247,7 +247,7 @@ private static void EvaluateRecursive (IExpressionEvaluatorFacade evaluatorFassa
IReportExpression expressionItem = exportColumn as IReportExpression;
if (expressionItem != null) {
- EvaluationHelper.EvaluateItem(evaluatorFassade,expressionItem);
+ evaluatorFassade.Evaluate(expressionItem);
}
}
}
View
44 src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Expressions/EvaluationHelper.cs
@@ -9,6 +9,7 @@
using System;
using ICSharpCode.Reports.Core;
using ICSharpCode.Reports.Core.Exporter;
+using ICSharpCode.Reports.Core.Globals;
using ICSharpCode.Reports.Core.Interfaces;
using SimpleExpressionEvaluator;
@@ -17,7 +18,7 @@ namespace ICSharpCode.Reports.Expressions.ReportingLanguage
/// <summary>
/// Description of EvaluationHelper.
/// </summary>
- public class EvaluationHelper
+ internal class EvaluationHelper
{
public static IExpressionEvaluatorFacade SetupEvaluator ()
@@ -32,11 +33,6 @@ public static IExpressionEvaluatorFacade CreateEvaluator (ISinglePage singlePag
throw new ArgumentNullException("singlePage");
}
- /*
- if (dataNavigator == null) {
- throw new ArgumentNullException("dataNavigator");
- }
- * */
singlePage.IDataNavigator = dataNavigator;
IExpressionEvaluatorFacade evaluatorFacade = new ExpressionEvaluatorFacade(singlePage);
return evaluatorFacade;
@@ -45,7 +41,8 @@ public static IExpressionEvaluatorFacade CreateEvaluator (ISinglePage singlePag
public static void EvaluateReportItems (IExpressionEvaluatorFacade evaluator,ReportItemCollection items)
{
- foreach(BaseReportItem column in items) {
+ foreach(BaseReportItem column in items)
+ {
var container = column as ISimpleContainer ;
if (container != null) {
EvaluateReportItems(evaluator,container.Items);
@@ -53,26 +50,11 @@ public static void EvaluateReportItems (IExpressionEvaluatorFacade evaluator,Re
IReportExpression expressionItem = column as IReportExpression;
if (expressionItem != null) {
- EvaluateItem(evaluator,expressionItem);
+ evaluator.Evaluate(expressionItem);
}
}
}
- public static void EvaluateItem( IExpressionEvaluatorFacade evaluator,IReportExpression expressionItem)
- {
- string expr = String.Empty;
- if (expressionItem != null)
- {
- if (!String.IsNullOrEmpty(expressionItem.Expression)) {
- expr = expressionItem.Expression;
- } else {
- expr = expressionItem.Text;
- }
- }
-
- expressionItem.Text = evaluator.Evaluate(expr);
- }
-
public static void EvaluateRow(IExpressionEvaluatorFacade evaluator,ExporterCollection row)
{
@@ -81,9 +63,10 @@ public static void EvaluateRow(IExpressionEvaluatorFacade evaluator,ExporterColl
if (container != null) {
EvaluateRow(evaluator,container.Items);
}
+
IReportExpression expressionItem = column as IReportExpression;
if (expressionItem != null) {
- EvaluateItem(evaluator,expressionItem);
+ evaluator.Evaluate(expressionItem);
}
}
}
@@ -96,5 +79,18 @@ public static bool CanEvaluate (string expression)
}
return false;
}
+
+
+ public static string ExtractExpressionPart (string src)
+ {
+ char v = Convert.ToChar("=");
+ return StringHelpers.RightOf(src,v).Trim();
+ }
+
+ public static string ExtractResultPart (string src)
+ {
+ char v = Convert.ToChar("=");
+ return StringHelpers.LeftOf(src,v).Trim();
+ }
}
}
View
49 src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Expressions/ExpressionEvaluatorFacade.cs
@@ -2,6 +2,8 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
+using ICSharpCode.Reports.Core;
+using ICSharpCode.Reports.Core.Globals;
using ICSharpCode.Reports.Core.Interfaces;
using SimpleExpressionEvaluator;
using SimpleExpressionEvaluator.Evaluation;
@@ -33,10 +35,18 @@ public ExpressionEvaluatorFacade(IPageInfo pageInfo)
public string Evaluate (string expression)
{
try {
- if (EvaluationHelper.CanEvaluate(expression)) {
- this.context.ContextObject = this.SinglePage;
- return EvaluateExpression(expression);
+
+ string s = EvaluationHelper.ExtractExpressionPart(expression);
+ if (s.Length > 0) {
+ this.context.ContextObject =this.SinglePage ;
+ return EvaluateExpression (s);
}
+
+// if (EvaluationHelper.CanEvaluate(expression)) {
+// this.context.ContextObject = this.SinglePage;
+// return EvaluateExpression(expression);
+// }
+
} catch (Exception e) {
expression = e.Message;
WriteLogMessage(e);
@@ -45,7 +55,23 @@ public string Evaluate (string expression)
return expression;
}
+ public string Evaluate (string expression, object row)
+ {
+ try {
+ string s = EvaluationHelper.ExtractExpressionPart(expression);
+ if (s.Length > 0) {
+ this.context.ContextObject = row;
+ return EvaluateExpression (s);
+ }
+ } catch (Exception e) {
+ expression = e.Message;
+ WriteLogMessage(e);
+ }
+
+ return expression;
+ }
+ /*
public string Evaluate (string expression, object row)
{
try {
@@ -60,6 +86,23 @@ public string Evaluate (string expression, object row)
return expression;
}
+ */
+
+ public void Evaluate (IReportExpression expressionItem)
+ {
+ if (expressionItem == null) {
+ throw new ArgumentException("expressionItem");
+ }
+ string expr = String.Empty;
+ if (!String.IsNullOrEmpty(expressionItem.Expression)) {
+ expr = expressionItem.Expression;
+ } else {
+ expr = expressionItem.Text;
+ }
+
+ expressionItem.Text = Evaluate(expr);
+ }
+
string EvaluateExpression(string expression)
View
1  src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Expressions/IExpressionEvaluatorFacade.cs
@@ -14,6 +14,7 @@ public interface IExpressionEvaluatorFacade
{
string Evaluate (string expression);
string Evaluate (string expression, object row);
+ void Evaluate (IReportExpression expressionItem);
IPageInfo SinglePage {get;set;}
}
}
View
18 ...Misc/Reports/ICSharpCode.Reports.Core/Project/Expressions/ReportingLanguage/ReportingLanguageCompiler.cs
@@ -34,8 +34,24 @@ public override IExpression<T> CompileExpression<T>(string expression)
if (String.IsNullOrEmpty(expression)) {
return null;
}
+ ParseTree node = this.compiler.Parse(expression);
+ if (node.Root == null) {
+ return null;
+ }
+ return CompileExpression<T>(node.Root);
+ }
+
+
+ /*
+ public override IExpression<T> CompileExpression<T>(string expression)
+ {
+ if (String.IsNullOrEmpty(expression)) {
+ return null;
+ }
string cleaned = CleanupExpressionString(expression);
+
+
if (!String.IsNullOrEmpty(cleaned)) {
ParseTree node = this.compiler.Parse(cleaned);
if (node.Root == null) {
@@ -56,7 +72,7 @@ private string CleanupExpressionString(string expression)
}
return str.TrimStart (delim.ToCharArray());
}
-
+ */
// Dron't call base
protected override IExpression<T> CompileExpression<T>(ParseTreeNode root)
View
142 src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Globals/StringHelpers.cs
@@ -0,0 +1,142 @@
+/*
+ * Created by SharpDevelop.
+ * User: Peter Forstmeier
+ * Date: 16.07.2011
+ * Time: 19:46
+ *
+ * To change this template use Tools | Options | Coding | Edit Standard Headers.
+ */
+using System;
+
+namespace ICSharpCode.Reports.Core.Globals
+{
+ public class StringHelpers
+ {
+ /// <summary>
+ /// Left of the first occurance of c
+ /// </summary>
+ /// <param name="src"></param>
+ /// <param name="c"></param>
+ /// <returns></returns>
+ public static string LeftOf(string src, char c)
+ {
+ int idx=src.IndexOf(c);
+ if (idx==-1)
+ {
+ return src;
+ }
+
+ return src.Substring(0, idx);
+ }
+
+ /// <summary>
+ /// Left of the n'th occurance of c
+ /// </summary>
+ /// <param name="src"></param>
+ /// <param name="c"></param>
+ /// <param name="n"></param>
+ /// <returns></returns>
+ public static string LeftOf(string src, char c, int n)
+ {
+ int idx=-1;
+ while (n != 0)
+ {
+ idx=src.IndexOf(c, idx+1);
+ if (idx==-1)
+ {
+ return src;
+ }
+ --n;
+ }
+ return src.Substring(0, idx);
+ }
+
+ /// <summary>
+ /// Right of the first occurance of c
+ /// </summary>
+ /// <param name="src"></param>
+ /// <param name="c"></param>
+ /// <returns></returns>
+ public static string RightOf(string src, char c)
+ {
+ int idx=src.IndexOf(c);
+ if (idx==-1)
+ {
+ return "";
+ }
+
+ return src.Substring(idx+1);
+ }
+
+ /// <summary>
+ /// Right of the n'th occurance of c
+ /// </summary>
+ /// <param name="src"></param>
+ /// <param name="c"></param>
+ /// <returns></returns>
+ public static string RightOf(string src, char c, int n)
+ {
+ int idx=-1;
+ while (n != 0)
+ {
+ idx=src.IndexOf(c, idx+1);
+ if (idx==-1)
+ {
+ return "";
+ }
+ --n;
+ }
+
+ return src.Substring(idx+1);
+ }
+
+ public static string LeftOfRightmostOf(string src, char c)
+ {
+ int idx=src.LastIndexOf(c);
+ if (idx==-1)
+ {
+ return src;
+ }
+ return src.Substring(0, idx);
+ }
+
+ public static string RightOfRightmostOf(string src, char c)
+ {
+ int idx=src.LastIndexOf(c);
+ if (idx==-1)
+ {
+ return src;
+ }
+ return src.Substring(idx+1);
+ }
+
+ public static string Between(string src, char start, char end)
+ {
+ string res=String.Empty;
+ int idxStart=src.IndexOf(start);
+ if (idxStart != -1)
+ {
+ ++idxStart;
+ int idxEnd=src.IndexOf(end, idxStart);
+ if (idxEnd != -1)
+ {
+ res=src.Substring(idxStart, idxEnd-idxStart);
+ }
+ }
+ return res;
+ }
+
+ public static int Count(string src, char find)
+ {
+ int ret=0;
+ foreach(char s in src)
+ {
+ if (s==find)
+ {
+ ++ret;
+ }
+ }
+ return ret;
+ }
+ }
+}
View
135 src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Xml/MycroParser.cs
@@ -220,140 +220,5 @@ void SetPropertyToString(object obj, PropertyInfo pi, string value)
}
}
-
- #region StringHelpers
- /// <summary>
- /// Helpers for string manipulation.
- /// </summary>
- public class StringHelpers
- {
- /// <summary>
- /// Left of the first occurance of c
- /// </summary>
- /// <param name="src"></param>
- /// <param name="c"></param>
- /// <returns></returns>
- public static string LeftOf(string src, char c)
- {
- int idx=src.IndexOf(c);
- if (idx==-1)
- {
- return src;
- }
-
- return src.Substring(0, idx);
- }
-
- /// <summary>
- /// Left of the n'th occurance of c
- /// </summary>
- /// <param name="src"></param>
- /// <param name="c"></param>
- /// <param name="n"></param>
- /// <returns></returns>
- public static string LeftOf(string src, char c, int n)
- {
- int idx=-1;
- while (n != 0)
- {
- idx=src.IndexOf(c, idx+1);
- if (idx==-1)
- {
- return src;
- }
- --n;
- }
- return src.Substring(0, idx);
- }
-
- /// <summary>
- /// Right of the first occurance of c
- /// </summary>
- /// <param name="src"></param>
- /// <param name="c"></param>
- /// <returns></returns>
- public static string RightOf(string src, char c)
- {
- int idx=src.IndexOf(c);
- if (idx==-1)
- {
- return "";
- }
-
- return src.Substring(idx+1);
- }
-
- /// <summary>
- /// Right of the n'th occurance of c
- /// </summary>
- /// <param name="src"></param>
- /// <param name="c"></param>
- /// <returns></returns>
- public static string RightOf(string src, char c, int n)
- {
- int idx=-1;
- while (n != 0)
- {
- idx=src.IndexOf(c, idx+1);
- if (idx==-1)
- {
- return "";
- }
- --n;
- }
-
- return src.Substring(idx+1);
- }
-
- public static string LeftOfRightmostOf(string src, char c)
- {
- int idx=src.LastIndexOf(c);
- if (idx==-1)
- {
- return src;
- }
- return src.Substring(0, idx);
- }
-
- public static string RightOfRightmostOf(string src, char c)
- {
- int idx=src.LastIndexOf(c);
- if (idx==-1)
- {
- return src;
- }
- return src.Substring(idx+1);
- }
-
- public static string Between(string src, char start, char end)
- {
- string res=String.Empty;
- int idxStart=src.IndexOf(start);
- if (idxStart != -1)
- {
- ++idxStart;
- int idxEnd=src.IndexOf(end, idxStart);
- if (idxEnd != -1)
- {
- res=src.Substring(idxStart, idxEnd-idxStart);
- }
- }
- return res;
- }
-
- public static int Count(string src, char find)
- {
- int ret=0;
- foreach(char s in src)
- {
- if (s==find)
- {
- ++ret;
- }
- }
- return ret;
- }
- }
- #endregion
}
}
View
1  ...Reports/ICSharpCode.Reports.Core/Test/ICSharpCode.Reports.Core.Test/ICSharpCode.Reports.Core.Test.csproj
@@ -93,7 +93,6 @@
<Compile Include="ReportingLanguage\IntegrationTests\AggregateFunctionsFixture.cs" />
<Compile Include="ReportingLanguage\IntegrationTests\AggregateFunctionsFromIListFixture.cs" />
<Compile Include="ReportingLanguage\IntegrationTests\ConcatFieldsFixture.cs" />
- <Compile Include="ReportingLanguage\IntegrationTests\FieldReferenceFixture.cs" />
<Compile Include="ReportingLanguage\IntegrationTests\GlobalFunctions.cs" />
<Compile Include="ReportingLanguage\IntegrationTests\SimpleCompilerFixture.cs" />
<Compile Include="ReportingLanguage\IntegrationTests\SubstringFixture.cs" />
View
24 ...harpCode.Reports.Core/Test/ICSharpCode.Reports.Core.Test/ReportingLanguage/ExpressionEvaluatorFixture.cs
@@ -29,6 +29,30 @@ public void Plain_Text_Returns_Unmodified ()
[Test]
+ public void ExtractExpressionPartFromString()
+ {
+ const string expression = "c = 5 + 3";
+ Assert.That(EvaluationHelper.ExtractExpressionPart(expression),Is.EqualTo("5 + 3"));
+ }
+
+
+ [Test]
+ public void MissingEqualSignReturnsEmptyString ()
+ {
+ const string expression = "5 + 3";
+ Assert.That(EvaluationHelper.ExtractExpressionPart(expression),Is.EqualTo(String.Empty));
+ }
+
+
+ [Test]
+ public void ExtractResultPartFromString()
+ {
+ const string expression = "c = 5 + 3";
+ Assert.That(EvaluationHelper.ExtractResultPart(expression),Is.EqualTo("c"));
+ }
+
+
+ [Test]
public void SimpleEvaluation ()
{
string expression = "=5 + 2";
View
13 ....Core/Test/ICSharpCode.Reports.Core.Test/ReportingLanguage/IntegrationTests/AggregateFunctionsFixture.cs
@@ -71,8 +71,7 @@ public void Count_Only_If_Matches()
{
const string expression = "=count(intvalue,current > 2)";
- Assert.That(this.evaluator.Evaluate(expression),
- Is.EqualTo("2"));
+ Assert.That(this.evaluator.Evaluate(expression), Is.EqualTo("2"));
}
// [Test]
@@ -139,16 +138,6 @@ public void UnknownField_ErrorMessage ()
#endregion
-
- #region test
- private void settest ()
- {
-
- }
-
- #endregion
-
-
[TestFixtureSetUp]
public void Init()
{
View
22 ...eports.Core/Test/ICSharpCode.Reports.Core.Test/ReportingLanguage/IntegrationTests/ConcatFieldsFixture.cs
@@ -19,15 +19,7 @@ public class ConcatFieldsFixture
private SinglePage singlePage;
private IDataManager dataManager;
-
- [Test]
- public void CheckTable ()
- {
- Assert.AreEqual(4,this.testTable.Rows.Count);
- }
-
[Test]
-
public void Return_FieldName_If_DataNavigator_Invalid()
{
const string expression = "=Fields!Name";
@@ -37,7 +29,7 @@ public void Return_FieldName_If_DataNavigator_Invalid()
[Test]
- public void Can_Compile_Misspelled_Simple_FieldReference()
+ public void Misspelled_Simple_FieldReference()
{
const string expression = "=fields!Name";
Assert.That(this.evaluator.Evaluate(expression), Is.EqualTo("Name"));
@@ -54,10 +46,8 @@ public void Evaluate_If_DataNavigator_Is_Invalid()
Assert.That(this.evaluator.Evaluate(expression), Is.EqualTo(testVal));
}
-
-
+
[Test]
- [Ignore]
public void Unkown_ColumnName ()
{
const string expression = "=Fields!Unknown";
@@ -66,14 +56,16 @@ public void Unkown_ColumnName ()
[Test]
- [IgnoreAttribute]
- public void ExtractFieldbyName ()
+ public void Extract_Field_ByName ()
{
const string expression = "=Fields!Name";
+ DataRow r = testTable.Rows[0];
+ string result = r["Name"].ToString();
Assert.That(this.evaluator.Evaluate(expression),
- Is.EqualTo(this.testTable.Rows.Count.ToString()));
+ Is.EqualTo(result));
}
+
[TestFixtureSetUp]
public void Init()
{
View
46 ...orts.Core/Test/ICSharpCode.Reports.Core.Test/ReportingLanguage/IntegrationTests/FieldReferenceFixture.cs
@@ -1,46 +0,0 @@
-// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
-// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
-
-using System;
-using ICSharpCode.Reports.Expressions.ReportingLanguage;
-using NUnit.Framework;
-using SimpleExpressionEvaluator;
-using SimpleExpressionEvaluator.Evaluation;
-using SimpleExpressionEvaluator.Utilities;
-
-
-namespace ICSharpCode.Reports.Core.Test.ReportingLanguage.IntegrationTests
-{
- [TestFixture]
- public class FieldReferenceFixture
- {
-
- private IExpressionEvaluatorFacade evaluator;
-
- [Test]
- [IgnoreAttribute]
- public void Can_Compile_Simple_FieldReference()
- {
- const string expression = "=Fields!Field1";
- Assert.That(this.evaluator.Evaluate(expression), Is.EqualTo("Field1"));
- }
-
-
- [Test]
- [IgnoreAttribute]
- public void Can_Concat_Simple_FieldReference()
- {
- const string expression = "=Fields!Field1 + 'SharpDevelopReporting'";
- Assert.That(this.evaluator.Evaluate(expression), Is.EqualTo("Field1SharpDevelopReporting"));
- }
-
-
-
- [TestFixtureSetUp]
- public void Init()
- {
- this.evaluator = new ExpressionEvaluatorFacade(TestHelper.CreateSinglePage());
-// this.evaluator.SinglePage = TestHelper.CreateSinglePage();
- }
- }
-}
View
9 ...orts.Core/Test/ICSharpCode.Reports.Core.Test/ReportingLanguage/IntegrationTests/SimpleCompilerFixture.cs
@@ -33,13 +33,6 @@ public void Can_Handle_Empty_Expression_After_Cleanup()
}
- [Test]
- public void Can_Handle_Null_Expression()
- {
- const string expression = null;
- Assert.That(this.evaluator.Evaluate(expression), Is.EqualTo(null));
- }
-
#endregion
#region SyntaxError
@@ -60,7 +53,7 @@ public void Can_Handle_Wrong_Syntax_Returns_Expression()
public void Can_Compile_Simple_Number()
{
const string expression = " =1.1";
- Assert.That(this.evaluator.Evaluate(expression), Is.EqualTo(expression));
+ Assert.That(this.evaluator.Evaluate(expression),Is.StringStarting("1"));
}
View
4 ...ports.Core/Test/ICSharpCode.Reports.Core.Test/ReportingLanguage/IntegrationTests/UserFunctionsFixture.cs
@@ -18,7 +18,7 @@ public class UserFunctionsFixture
public void UserNameFunction ()
{
BaseTextItem bti = new BaseTextItem();
- bti.Text = "=User!UserID";
+ bti.Text = "User!UserID";
IExpression compiled = this.compiler.CompileExpression<object>(bti.Text);
Assert.That(compiled.Evaluate(null), Is.EqualTo(Environment.UserName));
}
@@ -28,7 +28,7 @@ public void UserNameFunction ()
public void UserLanguageFunction ()
{
BaseTextItem bti = new BaseTextItem();
- bti.Text = "=User!Language";
+ bti.Text = "User!Language";
IExpression compiled = this.compiler.CompileExpression<object>(bti.Text);
Assert.That(compiled.Evaluate(null), Is.EqualTo(System.Globalization.CultureInfo.CurrentCulture.ThreeLetterISOLanguageName));
}
View
10 ...rts.Core/Test/ICSharpCode.Reports.Core.Test/ReportingLanguage/LanguageTests/AggregateFunctionsFixture.cs
@@ -15,7 +15,7 @@ public class AggregateFunctionsFixture
{
[Test]
- public void Test_Sum()
+ public void Array_Sum()
{
var data = new[] {1, 2, 4, 8, 16, 32, 64, 128};
var eStr = "sum()";
@@ -25,7 +25,7 @@ public void Test_Sum()
}
[Test]
- public void Average_Test()
+ public void Array_Average()
{
var data = new[] {2, 4, 6};
var eStr = "avg()";
@@ -36,7 +36,7 @@ public void Average_Test()
[Test]
- public void Average_Handles_Divide_By_Zero()
+ public void Array_Handles_Divide_By_Zero()
{
var data = new int[]{};
var eStr = "average()";
@@ -119,7 +119,7 @@ public void Count_Simple_Integers()
[Test]
- public void Min_Test()
+ public void Array_Min()
{
var data = new[] { 10, 7, 3, 9 };
var eStr = "min()";
@@ -129,7 +129,7 @@ public void Min_Test()
}
[Test]
- public void Max_Test()
+ public void Array_Max()
{
var data = new[] { 10, 7, 3, 9 };
var eStr = "max(current,current * 2)";
Please sign in to comment.
Something went wrong with that request. Please try again.