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_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); }
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); }
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_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)); }
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)); }
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)); }
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); }
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)); }
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()) { }
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); }
public ConcretePerformedStep(ConcreteActivityPerformer performer, DateTime? startTime) : base(performer, startTime, new PerformedStepStatusTransitionLogic()) { }
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)); }