@@ -3725,15 +3725,14 @@ public void Subtract_Decimal_To_MinDecimal()
3725
3725
Assert . IsNull ( subtractedValue ) ;
3726
3726
}
3727
3727
3728
- #region Slice tests
3728
+ #region Slice tests
3729
3729
3730
3730
/* Refer http://cql.hl7.org/09-b-cqlreference.html for operation details on Skip, Tail and Take cql operators
3731
3731
* These CQL operators uses Slice semantics from http://cql.hl7.org/04-logicalspecification.html#slice
3732
3732
*/
3733
3733
3734
- [ TestCategory ( "SliceTests" ) ]
3735
3734
[ TestMethod ]
3736
- public void Skip2 ( )
3735
+ public void Slice_Skip2 ( )
3737
3736
{
3738
3737
//The Skip operator returns the elements in the list, skipping the first number elements.
3739
3738
//define "Skip2": Skip({ 1, 2, 3, 4, 5 }, 2) // { 3, 4, 5 }
@@ -3745,9 +3744,8 @@ public void Skip2()
3745
3744
CollectionAssert . AreEqual ( expectedList , slicedList . ToList ( ) ) ;
3746
3745
}
3747
3746
3748
- [ TestCategory ( "SliceTests" ) ]
3749
3747
[ TestMethod ]
3750
- public void SkipNull ( )
3748
+ public void Slice_SkipNull ( )
3751
3749
{
3752
3750
//If the number of elements is null, the result is the entire list, no elements are skipped.
3753
3751
//define "SkipNull": Skip({ 1, 3, 5 }, null) // { 1, 3, 5 }
@@ -3758,10 +3756,9 @@ public void SkipNull()
3758
3756
Assert . IsNotNull ( slicedList ) ;
3759
3757
CollectionAssert . AreEqual ( expectedList , slicedList . ToList ( ) ) ;
3760
3758
}
3761
-
3762
- [ TestCategory ( "SliceTests" ) ]
3759
+
3763
3760
[ TestMethod ]
3764
- public void SkipEmpty ( )
3761
+ public void Slice_SkipEmpty ( )
3765
3762
{
3766
3763
//If the number of elements is less than zero, the result is an empty list.
3767
3764
//define "SkipEmpty": Skip({ 1, 3, 5 }, -1) // { }
@@ -3772,10 +3769,9 @@ public void SkipEmpty()
3772
3769
Assert . IsNotNull ( slicedList ) ;
3773
3770
CollectionAssert . AreEqual ( expectedList , slicedList . ToList ( ) ) ;
3774
3771
}
3775
-
3776
- [ TestCategory ( "SliceTests" ) ]
3772
+
3777
3773
[ TestMethod ]
3778
- public void SkipIsNull ( )
3774
+ public void Slice_SkipIsNull ( )
3779
3775
{
3780
3776
//If the source list is null, the result is null.
3781
3777
//define "SkipIsNull": Skip(null, 2)
@@ -3784,11 +3780,11 @@ public void SkipIsNull()
3784
3780
var expectedList = null as List < int > ;
3785
3781
var slicedList = rtx . Operators . Slice ( inputList , 2 , null ) ;
3786
3782
Assert . IsNull ( slicedList ) ;
3783
+ Assert . AreEqual ( expectedList , slicedList ) ;
3787
3784
}
3788
-
3789
- [ TestCategory ( "SliceTests" ) ]
3785
+
3790
3786
[ TestMethod ]
3791
- public void Tail234 ( )
3787
+ public void Slice_Tail234 ( )
3792
3788
{
3793
3789
//The Tail operator returns all but the first element from the given list.
3794
3790
//define "Tail234": Tail({ 1, 2, 3, 4 }) // { 2, 3, 4 }
@@ -3799,10 +3795,9 @@ public void Tail234()
3799
3795
Assert . IsNotNull ( slicedList ) ;
3800
3796
CollectionAssert . AreEqual ( expectedList , slicedList . ToList ( ) ) ;
3801
3797
}
3802
-
3803
- [ TestCategory ( "SliceTests" ) ]
3798
+
3804
3799
[ TestMethod ]
3805
- public void TailEmpty ( )
3800
+ public void Slice_TailEmpty ( )
3806
3801
{
3807
3802
//If the list is empty, the result is empty.
3808
3803
//define "TailEmpty": Tail({ }) // { }
@@ -3813,10 +3808,9 @@ public void TailEmpty()
3813
3808
Assert . IsNotNull ( slicedList ) ;
3814
3809
CollectionAssert . AreEqual ( expectedList , slicedList . ToList ( ) ) ;
3815
3810
}
3816
-
3817
- [ TestCategory ( "SliceTests" ) ]
3811
+
3818
3812
[ TestMethod ]
3819
- public void TailIsNull ( )
3813
+ public void Slice_TailIsNull ( )
3820
3814
{
3821
3815
//If the source list is null, the result is null.
3822
3816
//define "TailIsNull": Tail(null)
@@ -3825,11 +3819,11 @@ public void TailIsNull()
3825
3819
var expectedList = null as List < int > ;
3826
3820
var slicedList = rtx . Operators . Slice ( inputList , 1 , null ) ;
3827
3821
Assert . IsNull ( slicedList ) ;
3822
+ Assert . AreEqual ( expectedList , slicedList ) ;
3828
3823
}
3829
-
3830
- [ TestCategory ( "SliceTests" ) ]
3824
+
3831
3825
[ TestMethod ]
3832
- public void Take2 ( )
3826
+ public void Slice_Take2 ( )
3833
3827
{
3834
3828
//The Take operator returns the first number elements from the given list.
3835
3829
//define "Take2": Take({ 1, 2, 3, 4 }, 2) // { 1, 2 }
@@ -3840,10 +3834,9 @@ public void Take2()
3840
3834
Assert . IsNotNull ( slicedList ) ;
3841
3835
CollectionAssert . AreEqual ( expectedList , slicedList . ToList ( ) ) ;
3842
3836
}
3843
-
3844
- [ TestCategory ( "SliceTests" ) ]
3837
+
3845
3838
[ TestMethod ]
3846
- public void TakeTooMany ( )
3839
+ public void Slice_TakeTooMany ( )
3847
3840
{
3848
3841
//If the list has less than number elements, the result only contains the elements in the list.
3849
3842
//define "TakeTooMany": Take({ 1, 2 }, 3) // { 1, 2 }
@@ -3854,10 +3847,9 @@ public void TakeTooMany()
3854
3847
Assert . IsNotNull ( slicedList ) ;
3855
3848
CollectionAssert . AreEqual ( expectedList , slicedList . ToList ( ) ) ;
3856
3849
}
3857
-
3858
- [ TestCategory ( "SliceTests" ) ]
3850
+
3859
3851
[ TestMethod ]
3860
- public void TakeEmpty ( )
3852
+ public void Slice_TakeEmpty ( )
3861
3853
{
3862
3854
//If number is null, or 0 or less, the result is an empty list.
3863
3855
//define "TakeEmpty": Take({ 1, 2, 3, 4 }, null) // { }
@@ -3868,10 +3860,9 @@ public void TakeEmpty()
3868
3860
Assert . IsNotNull ( slicedList ) ;
3869
3861
CollectionAssert . AreEqual ( expectedList , slicedList . ToList ( ) ) ;
3870
3862
}
3871
-
3872
- [ TestCategory ( "SliceTests" ) ]
3863
+
3873
3864
[ TestMethod ]
3874
- public void TakeIsNull ( )
3865
+ public void Slice_TakeIsNull ( )
3875
3866
{
3876
3867
//If the source list is null, the result is null.
3877
3868
//define "TakeIsNull": Take(null, 2)
@@ -3880,33 +3871,9 @@ public void TakeIsNull()
3880
3871
var expectedList = null as List < int > ;
3881
3872
var slicedList = rtx . Operators . Slice ( inputList , 0 , 2 ) ;
3882
3873
Assert . IsNull ( slicedList ) ;
3874
+ Assert . AreEqual ( expectedList , slicedList ) ;
3883
3875
}
3884
3876
3885
- [ TestCategory ( "SliceTests" ) ]
3886
- [ TestMethod ]
3887
- public void Slice_array_source ( )
3888
- {
3889
- //Testing array as a source for Slice operator
3890
- var rtx = GetNewContext ( ) ;
3891
- var inputSource = new [ ] { 1 , 2 , 3 , 4 } ;
3892
- var expectedList = new List < int > { 1 , 2 } ;
3893
- var slicedList = rtx . Operators . Slice ( inputSource , 0 , 2 ) ;
3894
- Assert . IsNotNull ( slicedList ) ;
3895
- CollectionAssert . AreEqual ( expectedList , slicedList . ToList ( ) ) ;
3896
- }
3897
-
3898
- [ TestCategory ( "SliceTests" ) ]
3899
- [ TestMethod ]
3900
- public void Slice_linkedList_source ( )
3901
- {
3902
- // Testing LinkedList as a source for Slice operator
3903
- var rtx = GetNewContext ( ) ;
3904
- var inputSource = new LinkedList < int > ( new [ ] { 1 , 2 , 3 , 4 } ) ;
3905
- var expectedList = new List < int > { 1 , 2 } ;
3906
- var slicedList = rtx . Operators . Slice ( inputSource , 0 , 2 ) ;
3907
- Assert . IsNotNull ( slicedList ) ;
3908
- CollectionAssert . AreEqual ( expectedList , slicedList . ToList ( ) ) ;
3909
- }
3910
3877
#endregion
3911
3878
}
3912
3879
}
0 commit comments