public void AddTransitionFactories_Throws()
        {
            var graph = new TransitionFactoryImplicitGraph <CloneableTestVertex, Edge <CloneableTestVertex> >();

            // ReSharper disable once AssignNullToNotNullAttribute
            Assert.Throws <ArgumentNullException>(() => graph.AddTransitionFactories(null));
        }
        public void RemoveTransitionFactories()
        {
            var graph = new TransitionFactoryImplicitGraph <CloneableTestVertex, Edge <CloneableTestVertex> >();

            Assert.IsFalse(graph.RemoveTransitionFactory(null));

            var vertex1  = new CloneableTestVertex("1");
            var vertex2  = new CloneableTestVertex("2");
            var vertex3  = new CloneableTestVertex("3");
            var factory1 = new TestTransitionFactory <CloneableTestVertex>(vertex1, Enumerable.Empty <Edge <CloneableTestVertex> >());
            var factory2 = new TestTransitionFactory <CloneableTestVertex>(vertex2, Enumerable.Empty <Edge <CloneableTestVertex> >());
            var factory3 = new TestTransitionFactory <CloneableTestVertex>(vertex3, Enumerable.Empty <Edge <CloneableTestVertex> >());

            graph.AddTransitionFactories(new[] { factory1, factory2 });

            Assert.IsFalse(graph.ContainsTransitionFactory(null));
            Assert.IsTrue(graph.ContainsTransitionFactory(factory1));
            Assert.IsTrue(graph.ContainsTransitionFactory(factory2));

            Assert.IsFalse(graph.RemoveTransitionFactory(factory3));
            Assert.IsTrue(graph.RemoveTransitionFactory(factory1));
            Assert.IsFalse(graph.RemoveTransitionFactory(factory1));
            Assert.IsTrue(graph.RemoveTransitionFactory(factory2));

            var factory4 = new TestTransitionFactory <CloneableTestVertex>(
                vertex1,
                new[]
            {
                new Edge <CloneableTestVertex>(vertex1, vertex2),
                new Edge <CloneableTestVertex>(vertex1, vertex3)
            });

            graph.AddTransitionFactory(factory4);
            Assert.IsTrue(graph.ContainsTransitionFactory(factory4));

            // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            graph.OutEdges(vertex1);    // Force exploration from vertex1

            Assert.IsTrue(graph.RemoveTransitionFactory(factory4));
        }
        public void AddTransitionFactories()
        {
            var graph = new TransitionFactoryImplicitGraph <CloneableTestVertex, Edge <CloneableTestVertex> >();

            var vertex1  = new CloneableTestVertex("1");
            var vertex2  = new CloneableTestVertex("2");
            var factory1 = new TestTransitionFactory <CloneableTestVertex>(vertex1, Enumerable.Empty <Edge <CloneableTestVertex> >());
            var factory2 = new TestTransitionFactory <CloneableTestVertex>(vertex2, Enumerable.Empty <Edge <CloneableTestVertex> >());

            graph.AddTransitionFactories(new[] { factory1, factory2 });

            Assert.IsTrue(graph.ContainsTransitionFactory(factory1));
            Assert.IsTrue(graph.ContainsTransitionFactory(factory2));

            var vertex3  = new CloneableTestVertex("3");
            var factory3 = new TestTransitionFactory <CloneableTestVertex>(vertex3, Enumerable.Empty <Edge <CloneableTestVertex> >());

            graph.AddTransitionFactory(factory3);

            Assert.IsTrue(graph.ContainsTransitionFactory(factory1));
            Assert.IsTrue(graph.ContainsTransitionFactory(factory2));
            Assert.IsTrue(graph.ContainsTransitionFactory(factory3));
        }