End() public method

Mark the event as ended.
public End ( ) : void
return void
コード例 #1
0
        public void AutoTimedEventActivity_EndedAt_Property_Can_Be_Nulled()
        {
            var activity = new AutoTimedEventActivity("category", "variable");

            activity.End();
            activity.EndedAt = null;

            Assert.IsNull(activity.EndedAt);
        }
コード例 #2
0
        public void AutoTimedEventActivity_Ends_At_Correct_Time()
        {
            var earliest = DateTimeOffset.Now;
            var activity = new AutoTimedEventActivity("category", "variable");

            activity.End();
            var latest = DateTimeOffset.Now;

            Assert.IsNotNull(activity.EndedAt);
            Assert.IsTrue(activity.EndedAt >= earliest, "EndedAt too early expected after {0} found {1}", earliest, activity.EndedAt);
            Assert.IsTrue(activity.EndedAt <= latest, "EndedAt too late expected before {0} found {1}", latest, activity.EndedAt);
        }