You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CodingSeb.ExpressionEvaluator.Tests/ExpressionEvaluatorTests.cs
+66-8Lines changed: 66 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -496,6 +496,48 @@ public void TypeTesting(string expression, Type type)
496
496
[TestCase("new ClassForTest2(15).Value1",ExpectedResult=15,Category="Create instance with new Keyword")]
497
497
[TestCase("new CodingSeb.ExpressionEvaluator.Tests.OtherNamespace.ClassInOtherNameSpace1().Value1",ExpectedResult=26,Category="Create instance with new Keyword,Inline namespace")]
498
498
[TestCase("new Regex(@\"\\w*[n]\\w*\").Match(\"Which word contains the desired letter ?\").Value",ExpectedResult="contains",Category="Create instance with new Keyword")]
499
+
[TestCase("new List<string>(){ \"Hello\", \"Test\" }.GetType()",ExpectedResult=typeof(List<string>),Category="Create instance with new Keyword, Collection Initializer")]
500
+
[TestCase("new List<string>(){ \"Hello\", \"Test\" }.Count",ExpectedResult=2,Category="Create instance with new Keyword, Collection Initializer")]
501
+
[TestCase("new List<string>(){ \"Hello\", \"Test\" }[0]",ExpectedResult="Hello",Category="Create instance with new Keyword, Collection Initializer")]
502
+
[TestCase("new List<string>(){ \"Hello\", \"Test\" }[1]",ExpectedResult="Test",Category="Create instance with new Keyword, Collection Initializer")]
503
+
[TestCase("new List<string>{ \"Hello\", \"Test\" }.GetType()",ExpectedResult=typeof(List<string>),Category="Create instance with new Keyword, Collection Initializer")]
504
+
[TestCase("new List<string>{ \"Hello\", \"Test\" }.Count",ExpectedResult=2,Category="Create instance with new Keyword, Collection Initializer")]
505
+
[TestCase("new List<string>{ \"Hello\", \"Test\" }[0]",ExpectedResult="Hello",Category="Create instance with new Keyword, Collection Initializer")]
506
+
[TestCase("new List<string>{ \"Hello\", \"Test\" }[1]",ExpectedResult="Test",Category="Create instance with new Keyword, Collection Initializer")]
507
+
[TestCase("new ClassForTest1(){ IntProperty = 100, StringProperty = \"A Text\" }.GetType()",ExpectedResult=typeof(ClassForTest1),Category="Create instance with new Keyword, Object Initializer")]
508
+
[TestCase("new ClassForTest1(){ IntProperty = 100, StringProperty = \"A Text\" }.IntProperty",ExpectedResult=100,Category="Create instance with new Keyword, Object Initializer")]
509
+
[TestCase("new ClassForTest1(){ IntProperty = 100, StringProperty = \"A Text\" }.StringProperty",ExpectedResult="A Text",Category="Create instance with new Keyword, Object Initializer")]
510
+
[TestCase("new ClassForTest1{ IntProperty = 100, StringProperty = \"A Text\" }.GetType()",ExpectedResult=typeof(ClassForTest1),Category="Create instance with new Keyword, Object Initializer")]
511
+
[TestCase("new ClassForTest1{ IntProperty = 100, StringProperty = \"A Text\" }.IntProperty",ExpectedResult=100,Category="Create instance with new Keyword, Object Initializer")]
512
+
[TestCase("new ClassForTest1{ IntProperty = 100, StringProperty = \"A Text\" }.StringProperty",ExpectedResult="A Text",Category="Create instance with new Keyword, Object Initializer")]
513
+
[TestCase("new ClassForTest2(10){ Value2 = 100 }.GetType()",ExpectedResult=typeof(ClassForTest2),Category="Create instance with new Keyword, Object Initializer")]
514
+
[TestCase("new ClassForTest2(10){ Value2 = 100 }.Value1",ExpectedResult=10,Category="Create instance with new Keyword, Object Initializer")]
515
+
[TestCase("new ClassForTest2(10){ Value2 = 100 }.Value2",ExpectedResult=100,Category="Create instance with new Keyword, Object Initializer")]
516
+
[TestCase("new Dictionary<int, string>(){ [7] = \"seven\", [7+2] = \"nine\" }.GetType()",ExpectedResult=typeof(Dictionary<int,string>),Category="Create instance with new Keyword, Dictionary Initializer")]
517
+
[TestCase("new Dictionary<int, string>(){ [7] = \"seven\", [7+2] = \"nine\" }[7]",ExpectedResult="seven",Category="Create instance with new Keyword, Dictionary Initializer")]
518
+
[TestCase("new Dictionary<int, string>(){ [7] = \"seven\", [7+2] = \"nine\" }[9]",ExpectedResult="nine",Category="Create instance with new Keyword, Dictionary Initializer")]
519
+
[TestCase("new Dictionary<int, string>{ [7] = \"seven\", [7+2] = \"nine\" }.GetType()",ExpectedResult=typeof(Dictionary<int,string>),Category="Create instance with new Keyword, Dictionary Initializer")]
520
+
[TestCase("new Dictionary<int, string>{ [7] = \"seven\", [7+2] = \"nine\" }[7]",ExpectedResult="seven",Category="Create instance with new Keyword, Dictionary Initializer")]
521
+
[TestCase("new Dictionary<int, string>{ [7] = \"seven\", [7+2] = \"nine\" }[9]",ExpectedResult="nine",Category="Create instance with new Keyword, Dictionary Initializer")]
522
+
[TestCase("new Dictionary<string, int>(){ [\"seven\"] = 7, [\"nine\"] = 9 }.GetType()",ExpectedResult=typeof(Dictionary<string,int>),Category="Create instance with new Keyword, Dictionary Initializer")]
523
+
[TestCase("new Dictionary<string, int>(){ [\"seven\"] = 7, [\"nine\"] = 9 }[\"seven\"]",ExpectedResult=7,Category="Create instance with new Keyword, Dictionary Initializer")]
524
+
[TestCase("new Dictionary<string, int>(){ [\"seven\"] = 7, [\"nine\"] = 9 }[\"nine\"]",ExpectedResult=9,Category="Create instance with new Keyword, Dictionary Initializer")]
525
+
[TestCase("new Dictionary<string, int>{ [\"seven\"] = 7, [\"nine\"] = 9 }.GetType()",ExpectedResult=typeof(Dictionary<string,int>),Category="Create instance with new Keyword, Dictionary Initializer")]
526
+
[TestCase("new Dictionary<string, int>{ [\"seven\"] = 7, [\"nine\"] = 9 }[\"seven\"]",ExpectedResult=7,Category="Create instance with new Keyword, Dictionary Initializer")]
527
+
[TestCase("new Dictionary<string, int>{ [\"seven\"] = 7, [\"nine\"] = 9 }[\"nine\"]",ExpectedResult=9,Category="Create instance with new Keyword, Dictionary Initializer")]
528
+
[TestCase("new Dictionary<int, string>(){ {7 ,\"seven\"}, {7+2, \"nine\"} }.GetType()",ExpectedResult=typeof(Dictionary<int,string>),Category="Create instance with new Keyword, Dictionary Initializer")]
529
+
[TestCase("new Dictionary<int, string>(){ {7 ,\"seven\"}, {7+2, \"nine\"} }[7]",ExpectedResult="seven",Category="Create instance with new Keyword, Dictionary Initializer")]
530
+
[TestCase("new Dictionary<int, string>(){ {7 ,\"seven\"}, {7+2, \"nine\"} }[9]",ExpectedResult="nine",Category="Create instance with new Keyword, Dictionary Initializer")]
531
+
[TestCase("new Dictionary<int, string>{ {7 ,\"seven\"}, {7+2, \"nine\"} }.GetType()",ExpectedResult=typeof(Dictionary<int,string>),Category="Create instance with new Keyword, Dictionary Initializer")]
532
+
[TestCase("new Dictionary<int, string>{ {7 ,\"seven\"}, {7+2, \"nine\"} }[7]",ExpectedResult="seven",Category="Create instance with new Keyword, Dictionary Initializer")]
533
+
[TestCase("new Dictionary<int, string>{ {7 ,\"seven\"}, {7+2, \"nine\"} }[9]",ExpectedResult="nine",Category="Create instance with new Keyword, Dictionary Initializer")]
534
+
[TestCase("new Dictionary<string, int>(){ {\"seven\", 7} , {\"nine\", 9 } }.GetType()",ExpectedResult=typeof(Dictionary<string,int>),Category="Create instance with new Keyword, Dictionary Initializer")]
535
+
[TestCase("new Dictionary<string, int>(){ {\"seven\", 7} , {\"nine\", 9 } }[\"seven\"]",ExpectedResult=7,Category="Create instance with new Keyword, Dictionary Initializer")]
536
+
[TestCase("new Dictionary<string, int>(){ {\"seven\", 7} , {\"nine\", 9 } }[\"nine\"]",ExpectedResult=9,Category="Create instance with new Keyword, Dictionary Initializer")]
537
+
[TestCase("new Dictionary<string, int>{ {\"seven\", 7} , {\"nine\", 9 } }.GetType()",ExpectedResult=typeof(Dictionary<string,int>),Category="Create instance with new Keyword, Dictionary Initializer")]
538
+
[TestCase("new Dictionary<string, int>{ {\"seven\", 7} , {\"nine\", 9 } }[\"seven\"]",ExpectedResult=7,Category="Create instance with new Keyword, Dictionary Initializer")]
539
+
[TestCase("new Dictionary<string, int>{ {\"seven\", 7} , {\"nine\", 9 } }[\"nine\"]",ExpectedResult=9,Category="Create instance with new Keyword, Dictionary Initializer")]
540
+
499
541
#endregion
500
542
501
543
#region Logical And Shift Operators
@@ -688,13 +730,6 @@ public void TypeTesting(string expression, Type type)
[TestCase("$\"https://www.google.ch/search?q={System.Net.WebUtility.UrlEncode(\"test of request with url encode() ?\")}\"",ExpectedResult="https://www.google.ch/search?q=test+of+request+with+url+encode()+%3F",Category="Complex expression,Inline namespace")]
926
+
[TestCase("$\"https://www.google.com/search?q={System.Net.WebUtility.UrlEncode(\"test of request with url encode() ?\")}\"",ExpectedResult="https://www.google.com/search?q=test+of+request+with+url+encode()+%3F",Category="Complex expression,Inline namespace")]
0 commit comments