예제 #1
0
 public void Test_Ctor()
 {
     DateTime? now = DateTime.Now;
     ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();
     ConcretePerformedStep performedStep = new ConcretePerformedStep(activityPerformer, now);
     Assert.IsNotNull(performedStep.Activities);
     Assert.AreEqual(now, performedStep.StartTime);
     Assert.AreEqual(performedStep.Performer, activityPerformer);
 }
예제 #2
0
        public void Test_Complete_PerformerExistsAlready()
        {
            ConcreteActivity          activity          = new ConcreteActivity();
            ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();

            activity.Start(activityPerformer);

            activity.Complete(new ConcreteActivityPerformer(), DateTime.Now); // Perform event
        }
        public void Test_Ctor()
        {
            DateTime?now = DateTime.Now;
            ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();
            ConcretePerformedStep     performedStep     = new ConcretePerformedStep(activityPerformer, now);

            Assert.IsNotNull(performedStep.Activities);
            Assert.AreEqual(now, performedStep.StartTime);
            Assert.AreEqual(performedStep.Performer, activityPerformer);
        }
예제 #4
0
        public void Test_Assign()
        {
            ConcreteActivity          activity          = new ConcreteActivity();
            ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();

            activity.Assign(activityPerformer);

            Assert.IsNotNull(activity.Scheduling);
            Assert.AreEqual(activityPerformer, activity.Scheduling.Performer);
            Assert.AreEqual(ActivityStatus.SC, activity.State);
        }
예제 #5
0
        public void Test_Discontinue_NullEndTime()
        {
            DateTime? now = DateTime.Now;
            ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();
            ConcretePerformedStep performedStep = new ConcretePerformedStep(activityPerformer, now);
            Assert.AreEqual(PerformedStepStatus.IP, performedStep.State);

            performedStep.Discontinue(); // Perform event

            // Make assertions
            Assert.AreEqual(PerformedStepStatus.DC, performedStep.State);
            Assert.IsTrue(RoughlyEqual(performedStep.LastStateChangeTime, Platform.Time));
            Assert.IsTrue(RoughlyEqual(performedStep.EndTime, Platform.Time));
        }
예제 #6
0
        public void Test_Complete_NullArgs()
        {
            ConcreteActivity          activity          = new ConcreteActivity();
            ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();

            activity.Start(activityPerformer);

            activity.Complete(); // Perform event

            // Make assertions
            Assert.IsTrue(RoughlyEqual(Platform.Time, activity.EndTime));
            Assert.AreEqual(ActivityStatus.CM, activity.State);
            Assert.IsTrue(RoughlyEqual(Platform.Time, activity.LastStateChangeTime));
        }
예제 #7
0
        public void Test_Start_NullTime()
        {
            DateTime?                 now               = DateTime.Now;
            ConcreteActivity          activity          = new ConcreteActivity();
            ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();

            activity.Start(activityPerformer); // Perform event

            // Make assertions
            Assert.AreEqual(activityPerformer, activity.Performer);
            Assert.IsTrue(RoughlyEqual(Platform.Time, activity.StartTime));
            Assert.AreEqual(ActivityStatus.IP, activity.State);
            Assert.IsTrue(RoughlyEqual(Platform.Time, activity.LastStateChangeTime));
        }
예제 #8
0
        public void Test_Start()
        {
            DateTime?                 now               = DateTime.Now;
            ConcreteActivity          activity          = new ConcreteActivity();
            ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();

            activity.Start(activityPerformer, now); // Perform event

            // Make assertions
            Assert.AreEqual(activityPerformer, activity.Performer);
            Assert.AreEqual(now, activity.StartTime);
            Assert.AreEqual(ActivityStatus.IP, activity.State);
            Assert.AreEqual(now, activity.LastStateChangeTime);
        }
        public void Test_Discontinue_NullEndTime()
        {
            DateTime?now = DateTime.Now;
            ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();
            ConcretePerformedStep     performedStep     = new ConcretePerformedStep(activityPerformer, now);

            Assert.AreEqual(PerformedStepStatus.IP, performedStep.State);

            performedStep.Discontinue(); // Perform event

            // Make assertions
            Assert.AreEqual(PerformedStepStatus.DC, performedStep.State);
            Assert.IsTrue(RoughlyEqual(performedStep.LastStateChangeTime, Platform.Time));
            Assert.IsTrue(RoughlyEqual(performedStep.EndTime, Platform.Time));
        }
예제 #10
0
        public void Test_Complete()
        {
            DateTime?now = DateTime.Now;
            DateTime?end = now + TimeSpan.FromDays(3);
            ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();
            ConcreteActivity          activity          = new ConcreteActivity();

            activity.Complete(activityPerformer, end);// Perform event

            // Make assertions
            Assert.AreEqual(activityPerformer, activity.Performer);
            Assert.AreEqual(activity.StartTime, activity.EndTime);
            Assert.AreEqual(ActivityStatus.CM, activity.State);
            Assert.IsTrue(RoughlyEqual(Platform.Time, activity.LastStateChangeTime));
        }
        public void Test_Complete()
        {
            DateTime?now = DateTime.Now;
            DateTime?end = now + TimeSpan.FromDays(3);
            ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();
            ConcretePerformedStep     performedStep     = new ConcretePerformedStep(activityPerformer, now);

            Assert.AreEqual(PerformedStepStatus.IP, performedStep.State);

            performedStep.Complete(end); // Perform event

            // Make assertions
            Assert.AreEqual(PerformedStepStatus.CM, performedStep.State);
            Assert.IsTrue(RoughlyEqual(performedStep.LastStateChangeTime, Platform.Time));
            Assert.AreEqual(end, performedStep.EndTime);
        }
예제 #12
0
        public void Test_Timeshift()
        {
            DateTime?now = DateTime.Now;
            DateTime?end = DateTime.Now + TimeSpan.FromDays(30);
            ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();
            ConcreteActivity          activity          = new ConcreteActivity();

            activity.Schedule(now, end);
            activity.Start(activityPerformer, now);
            activity.Complete(end);

            activity.TimeShift(10);             // Perform event

            // Make assertions
            Assert.AreEqual(activity.StartTime, now.Value.AddMinutes(10));
            Assert.AreEqual(activity.EndTime, end.Value.AddMinutes(10));
            Assert.AreEqual(activity.Scheduling.StartTime, now.Value.AddMinutes(10));
            Assert.AreEqual(activity.Scheduling.EndTime, end.Value.AddMinutes(10));
        }
예제 #13
0
        public void Test_Complete_NullEndTime()
        {
            DateTime? now = DateTime.Now;
            DateTime? end = now + TimeSpan.FromDays(3);
            ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();
            ConcreteActivity activity = new ConcreteActivity();

            activity.Complete(activityPerformer); // Perform event

            // Make assertions
            Assert.IsTrue(RoughlyEqual(Platform.Time, activity.EndTime));
            Assert.AreEqual(activityPerformer, activity.Performer);
            Assert.AreEqual(activity.StartTime, activity.EndTime);
            Assert.AreEqual(ActivityStatus.CM, activity.State);
            Assert.IsTrue(RoughlyEqual(Platform.Time, activity.LastStateChangeTime));
        }
 public ConcretePerformedStep(ConcreteActivityPerformer performer, DateTime?startTime)
     : base(performer, startTime, new PerformedStepStatusTransitionLogic())
 {
 }
예제 #15
0
        public void Test_Assign()
        {
            ConcreteActivity activity = new ConcreteActivity();
            ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();

            activity.Assign(activityPerformer);

            Assert.IsNotNull(activity.Scheduling);
            Assert.AreEqual(activityPerformer, activity.Scheduling.Performer);
            Assert.AreEqual(ActivityStatus.SC, activity.State);
        }
예제 #16
0
        public void Test_Start()
        {
            DateTime? now = DateTime.Now;
            ConcreteActivity activity = new ConcreteActivity();
            ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();

            activity.Start(activityPerformer, now); // Perform event

            // Make assertions
            Assert.AreEqual(activityPerformer, activity.Performer);
            Assert.AreEqual(now, activity.StartTime);
            Assert.AreEqual(ActivityStatus.IP, activity.State);
            Assert.AreEqual(now, activity.LastStateChangeTime);
        }
예제 #17
0
        public void Test_Complete()
        {
            DateTime? now = DateTime.Now;
            DateTime? end = now + TimeSpan.FromDays(3);
            ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();
            ConcretePerformedStep performedStep = new ConcretePerformedStep(activityPerformer, now);
            Assert.AreEqual(PerformedStepStatus.IP, performedStep.State);

            performedStep.Complete(end); // Perform event

            // Make assertions
            Assert.AreEqual(PerformedStepStatus.CM, performedStep.State);
            Assert.IsTrue(RoughlyEqual(performedStep.LastStateChangeTime, Platform.Time));
            Assert.AreEqual(end, performedStep.EndTime);
        }
예제 #18
0
 public void Test_Start_NullTime()
 {
     DateTime? now = DateTime.Now;
     ConcreteActivity activity = new ConcreteActivity();
     ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();
     
     activity.Start(activityPerformer); // Perform event
     
     // Make assertions
     Assert.AreEqual(activityPerformer, activity.Performer);
     Assert.IsTrue(RoughlyEqual(Platform.Time, activity.StartTime));
     Assert.AreEqual(ActivityStatus.IP, activity.State);
     Assert.IsTrue(RoughlyEqual(Platform.Time, activity.LastStateChangeTime));
 }
예제 #19
0
 public ConcretePerformedStep(ConcreteActivityPerformer performer, DateTime? startTime)
     : base(performer, startTime, new PerformedStepStatusTransitionLogic())
 {
     
 }
예제 #20
0
        public void Test_Timeshift()
        {
			DateTime? now = DateTime.Now;
			DateTime? end = DateTime.Now + TimeSpan.FromDays(30);
            ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();
			ConcreteActivity activity = new ConcreteActivity();
			activity.Schedule(now, end);
            activity.Start(activityPerformer, now);
            activity.Complete(end);
			
			activity.TimeShift(10); // Perform event
			
            // Make assertions
            Assert.AreEqual(activity.StartTime, now.Value.AddMinutes(10));
			Assert.AreEqual(activity.EndTime, end.Value.AddMinutes(10));
			Assert.AreEqual(activity.Scheduling.StartTime, now.Value.AddMinutes(10));
			Assert.AreEqual(activity.Scheduling.EndTime, end.Value.AddMinutes(10));
        }
예제 #21
0
        public void Test_Complete_PerformerExistsAlready()
        {
            ConcreteActivity activity = new ConcreteActivity();
            ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();
            activity.Start(activityPerformer);

            activity.Complete(new ConcreteActivityPerformer(), DateTime.Now); // Perform event
        }
예제 #22
0
        public void Test_Complete_NullArgs()
        {
            ConcreteActivity activity = new ConcreteActivity();
            ConcreteActivityPerformer activityPerformer = new ConcreteActivityPerformer();
            activity.Start(activityPerformer);

            activity.Complete(); // Perform event

            // Make assertions
            Assert.IsTrue(RoughlyEqual(Platform.Time, activity.EndTime));
            Assert.AreEqual(ActivityStatus.CM, activity.State);
            Assert.IsTrue(RoughlyEqual(Platform.Time, activity.LastStateChangeTime));
        }