public void ObjectToString() { var place = new TestPlace(); var transition = new TestTransition(); var arc = new Arc <int>(place, transition); Assert.AreEqual("PlaceName -> TransitionName", arc.ToString()); arc = new Arc <int>(transition, place); Assert.AreEqual("TransitionName -> PlaceName", arc.ToString()); }
public void Constructor_Throws() { var place = new TestPlace(); var transition = new TestTransition(); // ReSharper disable ObjectCreationAsStatement // ReSharper disable AssignNullToNotNullAttribute Assert.Throws <ArgumentNullException>(() => new Arc <int>(null, transition)); Assert.Throws <ArgumentNullException>(() => new Arc <int>(place, null)); Assert.Throws <ArgumentNullException>(() => new Arc <int>((IPlace <int>)null, null)); Assert.Throws <ArgumentNullException>(() => new Arc <int>(null, place)); Assert.Throws <ArgumentNullException>(() => new Arc <int>(transition, null)); Assert.Throws <ArgumentNullException>(() => new Arc <int>((ITransition <int>)null, null)); // ReSharper restore AssignNullToNotNullAttribute // ReSharper restore ObjectCreationAsStatement }
public void Constructor() { var place = new TestPlace(); var transition = new TestTransition(); var arc = new Arc <int>(place, transition); Assert.IsTrue(arc.IsInputArc); Assert.AreSame(place, arc.Source); Assert.AreSame(place, arc.Place); Assert.AreSame(transition, arc.Target); Assert.AreSame(transition, arc.Transition); Assert.IsNotNull(arc.Annotation); arc = new Arc <int>(transition, place); Assert.IsFalse(arc.IsInputArc); Assert.AreSame(place, arc.Source); Assert.AreSame(place, arc.Place); Assert.AreSame(transition, arc.Target); Assert.AreSame(transition, arc.Transition); Assert.IsNotNull(arc.Annotation); }