File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ public class Session : MonoBehaviour
158158 public Trial PrevTrial { get { return GetPrevTrial ( ) ; } }
159159
160160 /// <summary>
161- /// Get the last trial in the last block of the session.
161+ /// Get the first trial in the first block of the session.
162162 /// </summary>
163163 public Trial FirstTrial { get { return GetFirstTrial ( ) ; } }
164164
@@ -648,7 +648,7 @@ Trial GetLastTrial()
648648 Block lastBlock ;
649649 try
650650 {
651- lastBlock = blocks [ 0 ] ;
651+ lastBlock = blocks [ blocks . Count - 1 ] ;
652652 }
653653 catch ( ArgumentOutOfRangeException )
654654 {
Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ public void SwapTrials()
133133 [ Test ]
134134 public void InvalidTrialAccess ( )
135135 {
136- Block block = session . CreateBlock ( ) ;
136+ session . CreateBlock ( ) ;
137137
138138 Assert . Throws < NoSuchTrialException > (
139139 delegate { Trial t = session . FirstTrial ; }
@@ -158,6 +158,19 @@ public void InvalidBlockAccess()
158158 delegate { Trial t = session . LastTrial ; }
159159 ) ;
160160 }
161+
162+ [ Test ]
163+ public void FirstLast ( )
164+ {
165+ Block block1 = session . CreateBlock ( 10 ) ;
166+ Block block2 = session . CreateBlock ( 10 ) ;
167+
168+ Assert . AreEqual ( block1 . trials [ 0 ] , session . FirstTrial ) ;
169+ Assert . AreEqual ( block2 . trials [ 9 ] , session . LastTrial ) ;
170+
171+ // reset blocks
172+ session . blocks = new List < Block > ( ) ;
173+ }
161174
162175 }
163176
You can’t perform that action at this time.
0 commit comments