Пример #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);
 }
        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);
        }
Пример #3
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));
        }
        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));
        }
        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);
        }
Пример #6
0
        public void Test_AddPerformedStep()
        {
            ConcreteActivity      activity      = new ConcreteActivity();
            ConcretePerformedStep performedStep = new ConcretePerformedStep();

            Assert.IsTrue(activity.PerformedSteps.IsEmpty);
            Assert.IsTrue(performedStep.Activities.IsEmpty);

            activity.AddPerformedStep(performedStep);// Perform event

            // Make assertions
            Assert.IsTrue(activity.PerformedSteps.Contains(performedStep));
            Assert.AreEqual(1, activity.PerformedSteps.Count);
            Assert.IsTrue(performedStep.Activities.Contains(activity));
            Assert.AreEqual(1, performedStep.Activities.Count);
        }
Пример #7
0
        public void Test_RemovePerformedStep_WithoutAdding()
        {
            ConcreteActivity      activity       = new ConcreteActivity();
            ConcretePerformedStep performedStep  = new ConcretePerformedStep();
            ConcretePerformedStep performedStep2 = new ConcretePerformedStep();

            activity.AddPerformedStep(performedStep2);

            Assert.AreEqual(1, activity.PerformedSteps.Count);
            Assert.IsTrue(activity.PerformedSteps.Contains(performedStep2));

            // remove a step that does not exist in the set
            activity.RemovePerformedStep(performedStep);// Perform event

            Assert.AreEqual(1, activity.PerformedSteps.Count);
            Assert.IsTrue(activity.PerformedSteps.Contains(performedStep2));
        }
Пример #8
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);
        }
Пример #9
0
        public void Test_RemovePerformedStep_WithoutAdding()
        {
            ConcreteActivity activity = new ConcreteActivity();
            ConcretePerformedStep performedStep = new ConcretePerformedStep();
            ConcretePerformedStep performedStep2 = new ConcretePerformedStep();

            activity.AddPerformedStep(performedStep2);

            Assert.AreEqual(1, activity.PerformedSteps.Count);
            Assert.IsTrue(activity.PerformedSteps.Contains(performedStep2));

            // remove a step that does not exist in the set
            activity.RemovePerformedStep(performedStep);// Perform event

            Assert.AreEqual(1, activity.PerformedSteps.Count);
            Assert.IsTrue(activity.PerformedSteps.Contains(performedStep2));
        }
Пример #10
0
        public void Test_RemovePerformedStep()
        {
            ConcreteActivity activity = new ConcreteActivity();
            ConcretePerformedStep performedStep = new ConcretePerformedStep();
            activity.AddPerformedStep(performedStep);

            Assert.IsTrue(activity.PerformedSteps.Contains(performedStep));
            Assert.AreEqual(1, activity.PerformedSteps.Count);
            Assert.IsTrue(performedStep.Activities.Contains(activity));
            Assert.AreEqual(1, performedStep.Activities.Count);

            activity.RemovePerformedStep(performedStep);// Perform event

            // Make assertions
            Assert.IsTrue(activity.PerformedSteps.IsEmpty);
            Assert.IsTrue(performedStep.Activities.IsEmpty);
        }