当前位置: 首页>>代码示例>>C#>>正文


C# Scope.DefineInnerScope方法代码示例

本文整理汇总了C#中RegexWizard.Framework.Scope.DefineInnerScope方法的典型用法代码示例。如果您正苦于以下问题:C# Scope.DefineInnerScope方法的具体用法?C# Scope.DefineInnerScope怎么用?C# Scope.DefineInnerScope使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RegexWizard.Framework.Scope的用法示例。


在下文中一共展示了Scope.DefineInnerScope方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DefineInnerScope_InCombinedParentOfTwoInners_SetsRootScopeOnInner

 public void DefineInnerScope_InCombinedParentOfTwoInners_SetsRootScopeOnInner()
 {
     Scope root = new     Scope("0123456789");
     Scope parent = root.DefineInnerScope(5, 4);
     //5678
     Scope combinedParent = root.DefineInnerScope(5, 5);//5678+9
     Scope innerChild = root.DefineInnerScope(6, 2);//67
     Assert.AreEqual(combinedParent.InnerLeftScope, innerChild.ParentScope);
     Assert.AreEqual(combinedParent, combinedParent.InnerLeftScope.ParentScope);
     Assert.AreEqual(combinedParent, combinedParent.InnerRightScope.ParentScope);
 }
开发者ID:FelicePollano,项目名称:dotnet-regex-tools,代码行数:11,代码来源:ScopeTests.cs

示例2: DefineInnerScope_WithleftMiddleandRightScopesasInner

        public void DefineInnerScope_WithleftMiddleandRightScopesasInner()
        {
            Scope root = new Scope("012345");
            root.DefineInnerScope(3, 1);//012|3|45
            ScopeSplitter splitter = new ScopeSplitter();
            splitter.AutoSplit(root, 2, 3, true);//01|(2|3|4)|5

            Scope encapsulator = root.DefineInnerScope(2, 3);
            Assert.AreEqual("2", encapsulator.InnerLeftScope.Text);
            Assert.AreEqual("3", encapsulator.InnerMiddleScope.Text);
            Assert.AreEqual("4", encapsulator.InnerRightScope.Text);
        }
开发者ID:FelicePollano,项目名称:dotnet-regex-tools,代码行数:12,代码来源:ScopeTests.cs

示例3: SetInnerScope_EncapsulatingInnerScopes_CreatesOuterScopeWithInnerScopes

 public void SetInnerScope_EncapsulatingInnerScopes_CreatesOuterScopeWithInnerScopes()
 {
     Scope root = new Scope("abcd");
     root.DefineInnerScope(1, 1);//b
     root.DefineInnerScope(2, 1);//'c' as inner of 'cd'
     Scope encapsulating = root.DefineInnerScope(1, 2);//'b'+'c' splitting 'd' to an implicit scope
     Assert.AreEqual("bc", encapsulating.Text);
 }
开发者ID:FelicePollano,项目名称:dotnet-regex-tools,代码行数:8,代码来源:ScopeTests.cs

示例4: SetInnerScope_WithScopeInTheEnd_DoesntSetInnerMiddleScope

 public void SetInnerScope_WithScopeInTheEnd_DoesntSetInnerMiddleScope()
 {
     scope = new Scope("abc");
     Scope newone = scope.DefineInnerScope(2, 1);
     Assert.IsNull(scope.InnerMiddleScope);
 }
开发者ID:FelicePollano,项目名称:dotnet-regex-tools,代码行数:6,代码来源:ScopeTests.cs

示例5: SetInnerScope_SetsParentCorrectlyRightScope

 public void SetInnerScope_SetsParentCorrectlyRightScope()
 {
     Scope rootScope = new Scope("abc");
     rootScope.DefineInnerScope(1, 1);
     Assert.AreSame(rootScope, rootScope.InnerRightScope.ParentScope);
 }
开发者ID:FelicePollano,项目名称:dotnet-regex-tools,代码行数:6,代码来源:ScopeTests.cs

示例6: SetInnerScope_SetsInnerRightScopePropertyToRightScope2

 public void SetInnerScope_SetsInnerRightScopePropertyToRightScope2()
 {
     scope = new Scope("defge");
     scope.DefineInnerScope(2, 1);
     Scope rightScopeWithCorrectProperties = new Scope("ge", 3);
     rightScopeWithCorrectProperties.IsExplicit = false;
     Assert.IsTrue(rightScopeWithCorrectProperties.Equals(scope.InnerRightScope));
 }
开发者ID:FelicePollano,项目名称:dotnet-regex-tools,代码行数:8,代码来源:ScopeTests.cs

示例7: Scope

        public void DefineInnerScope_WithleftMiddleandRightScopesasInner_RemovesOriginalScopesFromDirectRootAndIntoNewScope()
        {
            Scope root = new Scope("012");
            root.DefineInnerScope(1, 1);//1
            root.InnerRightScope.Suggestions.Add(new Suggestion("a","b"));
            root.InnerMiddleScope.Suggestions.Add(new Suggestion("a","b"));

            Scope encapsulator = root.DefineInnerScope(0, 2);//01

            Assert.AreEqual("0", encapsulator.InnerLeftScope.Text);
            Assert.AreEqual(null, encapsulator.InnerMiddleScope);
            Assert.AreEqual("1", encapsulator.InnerRightScope.Text);

            Assert.AreEqual("2", root.InnerRightScope.Text);
            Assert.AreEqual("01", root.InnerLeftScope.Text);
            Assert.AreEqual(null, root.InnerMiddleScope);

            Assert.AreEqual(1, root.InnerRightScope.Suggestions.Count);
            Assert.AreEqual(1, encapsulator.InnerRightScope.Suggestions.Count);
            Assert.AreEqual(encapsulator, encapsulator.InnerRightScope.ParentScope);
            Assert.AreEqual(encapsulator, encapsulator.InnerLeftScope.ParentScope);
        }
开发者ID:FelicePollano,项目名称:dotnet-regex-tools,代码行数:22,代码来源:ScopeTests.cs

示例8: SetInnerScope_SetsInnerLeftScopePropertyToLeftScope2

 public void SetInnerScope_SetsInnerLeftScopePropertyToLeftScope2()
 {
     scope = new Scope("defg");
     scope.DefineInnerScope(2, 1);
     Scope leftScopeWithCorrectProperties = new Scope("de", 0);
     leftScopeWithCorrectProperties.IsExplicit = false;
     Assert.IsTrue(leftScopeWithCorrectProperties.Equals(scope.InnerLeftScope));
 }
开发者ID:FelicePollano,项目名称:dotnet-regex-tools,代码行数:8,代码来源:ScopeTests.cs

示例9: SetInnerScope_SameScopeAsParent_ThrowsExcpetion

 public void SetInnerScope_SameScopeAsParent_ThrowsExcpetion()
 {
     scope = new Scope("abc");
     Scope inner = scope.DefineInnerScope(0, 3);
 }
开发者ID:FelicePollano,项目名称:dotnet-regex-tools,代码行数:5,代码来源:ScopeTests.cs

示例10: SetInnerScope_OnFirstCharInInnerScope_InnerInnerLeftScopeTextIsOK

 public void SetInnerScope_OnFirstCharInInnerScope_InnerInnerLeftScopeTextIsOK()
 {
     scope = new Scope("a text b");
     scope.DefineInnerScope(1, 5);//' text'
     scope.DefineInnerScope(1, 1);//' ' inside inner middle scope
     Assert.AreEqual(" ", scope.InnerMiddleScope.InnerLeftScope.Text);
 }
开发者ID:FelicePollano,项目名称:dotnet-regex-tools,代码行数:7,代码来源:ScopeTests.cs

示例11: SetInnerScope_IsFlat_CreatesTwoExtraScopesIfScopeIsInTheMiddle2

 public void SetInnerScope_IsFlat_CreatesTwoExtraScopesIfScopeIsInTheMiddle2()
 {
     scope = new Scope("abcd");
     Scope inner = scope.DefineInnerScope(1, 2);
     Scope[] innerScopes = scope.GetInnerScopes();
     Assert.AreEqual(3, innerScopes.Length);
 }
开发者ID:FelicePollano,项目名称:dotnet-regex-tools,代码行数:7,代码来源:ScopeTests.cs

示例12: SetInnerScope_IsFlat_CreatesOneExtraScopesIfScopeIsInTheEnd

 public void SetInnerScope_IsFlat_CreatesOneExtraScopesIfScopeIsInTheEnd()
 {
     scope = new Scope("abc");
     Scope inner = scope.DefineInnerScope(2, 1);
     Scope[] innerScopes = scope.GetInnerScopes();
     Assert.AreEqual(2, innerScopes.Length);
 }
开发者ID:FelicePollano,项目名称:dotnet-regex-tools,代码行数:7,代码来源:ScopeTests.cs

示例13: SetInnerScope_IfInnerScopeExists_DoesNotThrowsException

 public void SetInnerScope_IfInnerScopeExists_DoesNotThrowsException()
 {
     scope = new Scope("abc");
     scope.DefineInnerScope(0, 1);
     scope.DefineInnerScope(2, 1);
 }
开发者ID:FelicePollano,项目名称:dotnet-regex-tools,代码行数:6,代码来源:ScopeTests.cs

示例14: SetInnerScope_EncapsulatingInnerScopes_CreatesRightImplicitScopeSplitted

        public void SetInnerScope_EncapsulatingInnerScopes_CreatesRightImplicitScopeSplitted()
        {
            Scope root = new Scope("abcd");
            root.DefineInnerScope(1, 1);//b
            Assert.AreEqual("cd", root.InnerRightScope.Text);

            Scope encapsulating = root.DefineInnerScope(1, 2);//'b'+'c' splitting 'd' to an implicit scope

            Assert.AreEqual("d", root.InnerRightScope.Text);
            Assert.AreEqual("bc", root.InnerMiddleScope.Text);
            Assert.AreEqual(true, root.InnerRightScope.IsImplicit);
            Assert.AreEqual("b", encapsulating.InnerLeftScope.Text);
            Assert.AreEqual("c", encapsulating.InnerRightScope.Text);
        }
开发者ID:FelicePollano,项目名称:dotnet-regex-tools,代码行数:14,代码来源:ScopeTests.cs

示例15: SetInnerScope_EncapsulatingInnerScopes_CreatesOuterScopeWithInnerScopes2

 public void SetInnerScope_EncapsulatingInnerScopes_CreatesOuterScopeWithInnerScopes2()
 {
     Scope root = new Scope("abcd");
     root.DefineInnerScope(1, 1);//b
     root.DefineInnerScope(2, 1);//'c' as inner of 'cd'
     Scope encapsulating = root.DefineInnerScope(1, 3);//'bcd'
     Assert.AreEqual("bcd", encapsulating.Text);
 }
开发者ID:FelicePollano,项目名称:dotnet-regex-tools,代码行数:8,代码来源:ScopeTests.cs


注:本文中的RegexWizard.Framework.Scope.DefineInnerScope方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。