public void TransitionTokens_OnePredecessorZeroTokens_ThrowsInvalidOperationException()
        {
            // arrange
            Transition testTrans = new Transition(0, 0, "testTransition");
            testTrans.Successors.Clear();
            IList<String> predecessorIds = new List<String> { "predecessor_1" };
            StubPlace predecessor_1 = new StubPlace(predecessorIds[0], new List<INode> { }, new List<INode> { testTrans });
            predecessor_1.TokenCount = 0;
            testTrans.Predecessors.Clear();
            testTrans.Predecessors.Add(predecessor_1);

            // act
            testTrans.TransitionTokens((s, b) => { }, testCallback);
        }
        public void TransitionTokens_TwoPredecessorsNonZeroTokensNoSuccessors_CallbackTwice()
        {
            // arrange
            Transition testTrans = new Transition(0, 0, "testTransition");
            testTrans.Successors.Clear();
            IList<String> predecessorIds = new List<String> { "predecessor_1", "predecessor_2" };
            int tokenCount = new Random().Next(1, 999);
            StubPlace predecessor_1 = new StubPlace(predecessorIds[0], new List<INode> { }, new List<INode> { testTrans });
            predecessor_1.TokenCount = tokenCount;
            StubPlace predecessor_2 = new StubPlace(predecessorIds[1], new List<INode> { }, new List<INode> { testTrans });
            predecessor_2.TokenCount = tokenCount;
            testTrans.Predecessors.Clear();
            testTrans.Predecessors.Add(predecessor_1);
            testTrans.Predecessors.Add(predecessor_2);

            // act
            testTrans.TransitionTokens((s, b) => { }, testCallback);

            // assert
            Assert.IsTrue(Compare.UnorderedEqual(predecessorIds, callbackIds), "Callback called with incorrect ids.");
            Assert.AreEqual(tokenCount - 1, predecessor_2.TokenCount, "TokenCount not reduced correctly.");
        }
        public void TransitionTokens_NoPredecessorsNoSuccessors_NoCallback()
        {
            // arrange
            Transition testTrans = new Transition(0, 0, "testTransition");
            testTrans.Predecessors.Clear();
            testTrans.Successors.Clear();

            // act
            testTrans.TransitionTokens((s, b) => { }, testCallback);

            // assert
            Assert.AreEqual(0, callbackIds.Count, "No callback should occur when there are no successors or predecessors.");
        }