public void Bind(DateHolder data)
 {
     date      = data.Date;
     duration  = data.TotalDuration;
     isRunning = data.IsRunning;
     SetContentData();
 }
Exemple #2
0
        public void UsingExplicitContext()
        {
            var dateTime = new DateHolder();

            var sm = new SolidMachine <TelephoneTrigger>(dateTime);

            sm.State <IdleState>()
            .On(TelephoneTrigger.PickingUpPhone).GoesTo <DateReportingState>();
            sm.Start();

            sm.Trigger(TelephoneTrigger.PickingUpPhone);

            // The state should be able to use the specified context (dateTime variable) to report the date.
            Assert.IsTrue(dateTime.CurrentDate.Equals(DateTime.Now.Date), "Wrong date in context!");
        }