Ejemplo n.º 1
0
        protected static void ComputeWithRootAndTarget_Throws_Test <TGraph>(
            [NotNull] IMutableVertexSet <int> graph,
            [NotNull] RootedSearchAlgorithmBase <int, TGraph> algorithm)
            where TGraph : IImplicitVertexSet <int>
        {
            const int start = 1;
            const int end   = 2;

            Assert.Throws <ArgumentException>(() => algorithm.Compute(start));
            graph.AddVertex(start);

            Assert.Throws <InvalidOperationException>(() => algorithm.Compute(start));

            Assert.Throws <ArgumentException>(() => algorithm.Compute(start, end));
        }
Ejemplo n.º 2
0
        protected static void ComputeWithRootAndTarget_Throws_Test <TVertex, TGraph>(
            [NotNull] RootedSearchAlgorithmBase <TVertex, TGraph> algorithm)
            where TVertex : class, new()
            where TGraph : IImplicitVertexSet <TVertex>
        {
            var start = new TVertex();
            var end   = new TVertex();

            // ReSharper disable AssignNullToNotNullAttribute
            Assert.Throws <ArgumentNullException>(() => algorithm.Compute(null));
            Assert.Throws <ArgumentNullException>(() => algorithm.Compute(start, null));
            Assert.Throws <ArgumentNullException>(() => algorithm.Compute(null, end));
            Assert.Throws <ArgumentNullException>(() => algorithm.Compute(null, null));
            // ReSharper restore AssignNullToNotNullAttribute
        }
Ejemplo n.º 3
0
        protected static void ComputeWithRootAndTarget_Test <TGraph>(
            [NotNull] RootedSearchAlgorithmBase <int, TGraph> algorithm)
            where TGraph : IImplicitVertexSet <int>
        {
            const int start = 0;
            const int end   = 1;

            Assert.DoesNotThrow(() => algorithm.Compute(start, end));
            Assert.IsTrue(algorithm.TryGetRootVertex(out int root));
            Assert.IsTrue(algorithm.TryGetTargetVertex(out int target));
            AssertEqual(start, root);
            AssertEqual(end, target);
        }