Пример #1
0
        public void TestCircularClusterDefinition()
        {
            SyntaxDefinition circular = new SyntaxDefinition("circular");
            SyntaxContext mainContext = circular.MainContext;

            new Keyword(mainContext, "seventeenth", "JohnLocke", true);
            new Keyword(mainContext, "seventeenth", "Newton", true);

            new Keyword(mainContext, "eighteenth", "Voltaire", true);
            new Keyword(mainContext, "eighteenth", "AdamSmith", true);

            new Keyword(mainContext, "nineteenth", "KarlMarx", true);
            new Keyword(mainContext, "nineteenth", "Maxwell", true);

            new Keyword(mainContext, "twentieth", "Einstein", true);
            new Keyword(mainContext, "twentieth", "Chomsky", true);

            circular.GetCluster("@Everybody", mainContext).SetContentsTo("@Everybody,seventeenth,eighteenth,nineteenth,twentieth,@Everybody");

            circular.GetCluster("@Thing1", mainContext).SetContentsTo("seventeenth,@Thing2");
            circular.GetCluster("@Thing2", mainContext).SetContentsTo("eighteenth,@Thing1");

            circular.FinishSyntaxDefinition();

            Assert.AreEqual(8, circular.GetCluster("@Everybody", mainContext).CachedMemberItems.Items.Length);
            Assert.AreEqual(4, circular.GetCluster("@Thing1", mainContext).CachedMemberItems.Items.Length);
            Assert.AreEqual(4, circular.GetCluster("@Thing2", mainContext).CachedMemberItems.Items.Length);
        }