protected override void Check() { GenerateStateSpace(new C1()); StateCount.ShouldBe(3); TransitionCount.ShouldBe(6); ComputedTransitionCount.ShouldBe(6); GenerateStateSpace(new C2()); StateCount.ShouldBe(1); TransitionCount.ShouldBe(2); ComputedTransitionCount.ShouldBe(2); GenerateStateSpace(new C3()); StateCount.ShouldBe(1); TransitionCount.ShouldBe(2); ComputedTransitionCount.ShouldBe(3); GenerateStateSpace(new C4()); StateCount.ShouldBe(2); TransitionCount.ShouldBe(4); ComputedTransitionCount.ShouldBe(5); }
protected override void Check() { GenerateStateSpace(new C()); StateCount.ShouldBe(51); TransitionCount.ShouldBe(52); }
protected override void Check() { AllowFaultsOnInitialTransitions = true; GenerateStateSpace(new C1()); StateCount.ShouldBe(3); TransitionCount.ShouldBe(6); ComputedTransitionCount.ShouldBe(6); GenerateStateSpace(new C2()); StateCount.ShouldBe(1); TransitionCount.ShouldBe(2); ComputedTransitionCount.ShouldBe(2); GenerateStateSpace(new C3()); StateCount.ShouldBe(1); TransitionCount.ShouldBe(2); ComputedTransitionCount.ShouldBe(3); GenerateStateSpace(new C4()); StateCount.ShouldBe(2); TransitionCount.ShouldBe(4); ComputedTransitionCount.ShouldBe(5); }
public void OnAny_action_is_called_with_the_expected_parameters() { var machine = GetFixtureCompiler <TransitionCount>() .OnAny((from, trigger, to, count) => { ++count.transitionCount; if (count.transitionCount == 1) { Assert.That(from, Is.EqualTo(DoorState.Closed)); Assert.That(trigger, Is.EqualTo(DoorEvents.Open)); Assert.That(to, Is.EqualTo(DoorState.Open)); } else if (count.transitionCount == 2) { Assert.That(from, Is.EqualTo(DoorState.Open)); Assert.That(trigger, Is.EqualTo(DoorEvents.Close)); Assert.That(to, Is.EqualTo(DoorState.Closed)); } }) .Compile(); var transitionCount = new TransitionCount[ParallelTestCount]; for (int i = 0; i < ParallelTestCount; i++) { transitionCount[i] = new TransitionCount(machine); } Parallel.ForEach(transitionCount, storage => { machine.Fire(DoorEvents.Open, storage); machine.Fire(DoorEvents.Close, storage); }); }
public void OnAny_action_is_called_after_every_successful_transition() { var machine = GetFixtureCompiler <TransitionCount>() .OnAny((count) => { ++count.transitionCount; if (count.transitionCount == 1) { Assert.That(count.Memory.State, Is.EqualTo(DoorState.Open)); } else if (count.transitionCount == 2) { Assert.That(count.Memory.State, Is.EqualTo(DoorState.Closed)); } else { Assert.Fail(); } }) .Compile(); var transitionCount = new TransitionCount[ParallelTestCount]; for (int i = 0; i < ParallelTestCount; i++) { transitionCount[i] = new TransitionCount(machine); } Parallel.ForEach(transitionCount, storage => { machine.Fire(DoorEvents.Open, storage); machine.Fire(DoorEvents.Close, storage); Assert.That(storage.transitionCount, Is.EqualTo(2)); }); }
protected override void Check() { GenerateStateSpace(new C()); StateCount.ShouldBe(6); TransitionCount.ShouldBe(26); ComputedTransitionCount.ShouldBe(31); }