Exemplo n.º 1
0
        public void CanIngestGraphWithValidConfiguration()
        {
            IGraphIngestionService graphIngestionService = new GraphIngestionService();

            var validGraphDefinitionList = new List <string>()
            {
                "KittenService: ",
                "Leetmeme: Cyberportal",
                "Cyberportal: Ice",
                "CamelCaser: KittenService",
                "Fraudstream: Leetmeme",
                "Ice: "
            };

            try
            {
                var graph = graphIngestionService.Ingest(validGraphDefinitionList);
                Assert.AreEqual(graph.Nodes.Count, 6);

                var cyberPortalNode = graph.GetNodeWithValue("Cyberportal");
                var leetMemeNode    = graph.GetNodeWithValue("Leetmeme");

                Assert.IsTrue(cyberPortalNode.Children.Contains(leetMemeNode));
            }
            catch (ArgumentException ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Exemplo n.º 2
0
        public void CanIngestGraphAndDetectCircularReferences()
        {
            IGraphIngestionService graphIngestionService = new GraphIngestionService();

            var invalidGraphDefinitionList = new List <string>()
            {
                "KittenService: ",
                "Leetmeme: Cyberportal",
                "Cyberportal: Ice",
                "CamelCaser: KittenService",
                "Fraudstream: ",
                "Ice: Leetmeme"
            };

            Assert.ThrowsException <ArgumentException>(() => graphIngestionService.Ingest(invalidGraphDefinitionList));
        }