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


C# List.InsertRange方法代码示例

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


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

示例1: AppsListBuilder

 private void AppsListBuilder(IEnumerable<List<App>> result)
 {
     _asyncAppsResult = new List<App>();
     foreach (var userResult in result)
     {
         _asyncAppsResult.InsertRange(0, userResult);
     }
     Completion.Set();
 }
开发者ID:hywelandrews,项目名称:SoundCloud.Api.Net,代码行数:9,代码来源:AppsResourceTests.cs

示例2: CommentsListBuilder

 private void CommentsListBuilder(List<List<Comment>> result)
 {
     _asyncCommentsResult = new List<Comment>();
     foreach (var userResult in result)
     {
         _asyncCommentsResult.InsertRange(0, userResult);
     }
     Completion.Set();
 }
开发者ID:hywelandrews,项目名称:SoundCloud.Api.Net,代码行数:9,代码来源:CommentsResourceTests.cs

示例3: TestAddGetRemove

		public void TestAddGetRemove ()
		{
			var foos = new List<string> (){ "1", "2", "3" };
			Assert.AreEqual (3, foos.Count);

			foos [2] = "MooFoey!";
			Assert.IsTrue (foos.Contains ("MooFoey!"));
			Assert.AreEqual ("MooFoey!", foos [2]);

			foos.Add ("Hello!");
			Assert.AreEqual (4, foos.Count);

			foos.Remove ("Hello!");
			Assert.AreEqual (3, foos.Count);

			foos.Insert (1, "foomoey!");
			Assert.AreEqual (4, foos.Count);

			foos.InsertRange (1, new List<string>{ "1", "2", "3" }); 
			Assert.AreEqual (7, foos.Count);

			foos.Clear ();
			Assert.IsEmpty (foos);
		}
开发者ID:caloggins,项目名称:DOT-NET-on-Linux,代码行数:24,代码来源:ListExampleTests.cs

示例4: TestAddMessage

        public void TestAddMessage()
        {
            Application app = SingletonProvider<TestSetup>.Instance.GetApp();
             Utilities utilities = app.Utilities;

             Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");

             // Create a new folder.
             IMAPFolder folder = account.IMAPFolders.get_ItemByName("INBOX");
             folder.Save();

             for (int i = 0; i < 3; i++)
             {
            hMailServer.Message message = folder.Messages.Add();
            message.set_Flag(eMessageFlag.eMFSeen, true);
            message.Save();

            POP3ClientSimulator.AssertMessageCount(account.Address, "test", ((i + 1)*2) - 1);

            SMTPClientSimulator.StaticSend("[email protected]", account.Address, "Test", "Test");
            POP3ClientSimulator.AssertMessageCount(account.Address, "test", (i + 1)*2);
             }

             POP3ClientSimulator.AssertMessageCount(account.Address, "test", 6);

             var sim = new IMAPClientSimulator();
             sim.ConnectAndLogon(account.Address, "test");
             sim.SelectFolder("Inbox");

             string response = sim.Fetch("1:6 UID");

             string[] lines = Strings.Split(response, Environment.NewLine, -1, CompareMethod.Text);

             var uids = new List<string>();

             foreach (string line in lines)
             {
            int paraPos = line.IndexOf("(");
            int paraEndPos = line.IndexOf(")");

            if (paraPos < 0 || paraEndPos < 0)
               continue;

            string paraContent = line.Substring(paraPos + 1, paraEndPos - paraPos - 1);

            if (!uids.Contains(paraContent))
               uids.Add(paraContent);
             }

             CustomAssert.AreEqual(6, uids.Count);

             // Make sure the UIDS are sorted properly by creating a copy, sort the copy
             // and then compare to original.
             var copy = new List<string>();
             copy.InsertRange(0, uids);
             copy.Sort();

             CustomAssert.AreEqual(copy, uids);
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:59,代码来源:Basics.cs

示例5: AddToStandardList

 private string[] AddToStandardList(params string[] tags)
 {
     List<string> result = new List<string>(standardTags);
     result.InsertRange(0, tags);
     return result.ToArray();
 }
开发者ID:IntranetFactory,项目名称:ndjango,代码行数:6,代码来源:Designer.cs

示例6: ValidateSyntaxTree

        private void ValidateSyntaxTree(NDjango.Interfaces.ITemplateManager manager)
        {
            ITemplate template = manager.GetTemplate(Template, new TestTyperesolver(),
                new NDjango.TypeResolver.ModelDescriptor(new NDjango.TypeResolver.IDjangoType[]
                    {
                        new NDjango.TypeResolver.CLRTypeDjangoType("Standard", typeof(EmptyClass))
                    }));

            //the same logic responsible for retriving nodes as in NodeProvider class (DjangoDesigner).
            List<INode> nodes = GetNodes(template.Nodes.ToList<INodeImpl>().ConvertAll
                (node => (INode)node)).FindAll(node =>
                    (node is ICompletionValuesProvider)
                    || (node.NodeType == NodeType.ParsingContext)
                    || (node.ErrorMessage.Message != ""));
            List<DesignerData> actualResult = nodes.ConvertAll(
                node =>
                {
                    var value_provider = node as ICompletionValuesProvider;
                    var values =
                        value_provider == null ?
                            new List<string>()
                            : value_provider.Values;
                    List<string> contextValues = new List<string>(values);
                    if (node.NodeType == NodeType.ParsingContext)
                    {
                        contextValues.InsertRange(0 ,(node.Context.TagClosures));
                        return new DesignerData(node.Position, node.Length, contextValues.ToArray(), node.ErrorMessage.Severity, node.ErrorMessage.Message);
                    }
                    else if (node.NodeType == NodeType.Reference)
                    {
                        return new DesignerData(node.Position, node.Length, GetModelValues(node.Context.Model, RecursionDepth).ToArray(), node.ErrorMessage.Severity, node.ErrorMessage.Message);
                    }
                    else
                        return new DesignerData(node.Position, node.Length, new List<string>(values).ToArray(), node.ErrorMessage.Severity, node.ErrorMessage.Message);
                });

            for (int i = 0; i < actualResult.Count; i++)
            {
                if (actualResult[i].Values.Length == 0)
                    continue;

                Assert.AreEqual(ResultForDesigner[i].Length, actualResult[i].Length, "Invalid Length");
                Assert.AreEqual(ResultForDesigner[i].Position, actualResult[i].Position, "Invalid Position");
                Assert.AreEqual(ResultForDesigner[i].Severity, actualResult[i].Severity, "Invalid Severity");
                Assert.AreEqual(ResultForDesigner[i].ErrorMessage, actualResult[i].ErrorMessage, "Invalid ErrorMessage");
                Assert.AreEqual(ResultForDesigner[i].Values, actualResult[i].Values, "Invalid Values Array " + i);
            }
        }
开发者ID:IntranetFactory,项目名称:ndjango,代码行数:48,代码来源:TestDescriptor.cs

示例7: Prepend_ToArray_QueryUsingCql

        public void Prepend_ToArray_QueryUsingCql()
        {
            Tuple<Table<EntityWithArrayType>, List<EntityWithArrayType>> tupleArrayType = EntityWithArrayType.SetupDefaultTable(_session);
            Table<EntityWithArrayType> table = tupleArrayType.Item1;
            List<EntityWithArrayType> expectedEntities = tupleArrayType.Item2;

            string[] arrToAdd = new string[] { "random_" + Randomm.RandomAlphaNum(10), "random_" + Randomm.RandomAlphaNum(10), "random_" + Randomm.RandomAlphaNum(10), };
            List<string> listReversed = arrToAdd.ToList();
            listReversed.Reverse();
            string[] arrReversed = listReversed.ToArray();

            EntityWithArrayType singleEntity = expectedEntities.First();
            EntityWithArrayType expectedEntity = singleEntity.Clone();
            List<string> strValsAsList = new List<string>();
            strValsAsList.AddRange(expectedEntity.ArrayType);
            strValsAsList.InsertRange(0, arrReversed);
            expectedEntity.ArrayType = strValsAsList.ToArray();

            // Append the values
            table.Where(t => t.Id == singleEntity.Id).Select(t => new EntityWithArrayType { ArrayType = CqlOperator.Prepend(arrToAdd) }).Update().Execute();

            // Validate the final state of the data
            List<Row> rows = _session.Execute("SELECT * from " + table.Name + " where id='" + expectedEntity.Id + "'").GetRows().ToList();
            Assert.AreEqual(1, rows.Count);
            Assert.AreNotEqual(expectedEntity.ArrayType, singleEntity.ArrayType);
            string[] actualArr = rows[0].GetValue<string[]>("arraytype");
            CollectionAssert.AreEquivalent(expectedEntity.ArrayType, actualArr);
        }
开发者ID:mtf30rob,项目名称:csharp-driver,代码行数:28,代码来源:Prepend.cs

示例8: ValidateSyntaxTree

        private void ValidateSyntaxTree(NDjango.Interfaces.ITemplateManager manager)
        {
            ITemplate template = manager.GetTemplate(Template);

            //the same logic responsible for retriving nodes as in NodeProvider class (DjangoDesigner).
            List<INode> nodes = GetNodes(template.Nodes.ToList<INodeImpl>().ConvertAll
                (node => (INode)node)).FindAll(node =>
                    (node.Values.ToList().Count != 0)
                    || (node.NodeType == NodeType.ParsingContext)
                    || (node.ErrorMessage.Message != ""));
            List<DesignerData> actualResult = nodes.ConvertAll(
                node =>
                {
                    List<string> contextValues = new List<string>(node.Values);
                    if (node.NodeType == NodeType.ParsingContext)
                    {
                        contextValues.InsertRange(0 ,((ParserNodes.ParsingContextNode)node).Context.TagClosures);
                        return new DesignerData(node.Position, node.Length, contextValues.ToArray(), node.ErrorMessage.Severity, node.ErrorMessage.Message);
                    }
                    else
                        return new DesignerData(node.Position, node.Length, new List<string>(node.Values).ToArray(), node.ErrorMessage.Severity, node.ErrorMessage.Message);
                });

            for (int i = 0; i < actualResult.Count; i++)
            {
                if (actualResult[i].Values.Length == 0)
                    continue;

                Assert.AreEqual(actualResult[i].Length, ResultForDesigner[i].Length, "Invalid Length");
                Assert.AreEqual(actualResult[i].Position, ResultForDesigner[i].Position, "Invalid Position");
                Assert.AreEqual(actualResult[i].Severity, ResultForDesigner[i].Severity, "Invalid Severity");
                Assert.AreEqual(actualResult[i].ErrorMessage, ResultForDesigner[i].ErrorMessage, "Invalid ErrorMessage");
                Assert.AreEqual(actualResult[i].Values, ResultForDesigner[i].Values, "Invalid Values");
            }
        }
开发者ID:IntranetFactory,项目名称:ndjango,代码行数:35,代码来源:TestDescriptor.cs

示例9: InsertPluginTabs

        // causes System.ArgumentException : Delegate to an instance method cannot have null 'this'
        //[Test]
        //public void Test_PluginDialog()
        //{
        //    new PluginDialogTest().RunDialogTests();
        //}

        private string[] InsertPluginTabs(string[] tabs, params string[] plugintabs)
        {
            List<string> newtabs = new List<string>(tabs);
            newtabs.InsertRange(newtabs.Count - 1, plugintabs);
            return newtabs.ToArray();
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:13,代码来源:PluginTest_TabPage.cs

示例10: ShiftAlpha

        private List<char> ShiftAlpha(string cipher)
        {
            var alpha = new List<char>(new char[26].Select((a, b) => (char)(b + 97)).ToArray());
            var startIndex = alpha.IndexOf(Convert.ToChar(cipher));

            var alphaNew = new char[alpha.Count];
            alpha.CopyTo(alphaNew);

            alpha.InsertRange(alpha.Count, alphaNew.Take(startIndex));
            return alpha.Skip(startIndex).ToList();
        }
开发者ID:sbastianpatzelt,项目名称:CodeKatas,代码行数:11,代码来源:OctothorpeAlgorithmTests.cs

示例11: GroupsListBuilder

 private void GroupsListBuilder(List<List<Group>> result)
 {
     _asyncGroupsResult = new List<Group>();
     foreach (var userResult in result)
     {
         _asyncGroupsResult.InsertRange(0, userResult);
     }
     Completion.Set();
 }
开发者ID:hywelandrews,项目名称:SoundCloud.Api.Net,代码行数:9,代码来源:GroupsResourceTests.cs

示例12: TrackListBuilder

 private void TrackListBuilder(IEnumerable<List<Track>> result)
 {
     _asyncTracksResult = new List<Track>();
     foreach (var userResult in result)
     {
         _asyncTracksResult.InsertRange(0, userResult);
     }
     Completion.Set();
 }
开发者ID:hywelandrews,项目名称:SoundCloud.Api.Net,代码行数:9,代码来源:TracksResourceTests.cs

示例13: UserListBuilder

 private void UserListBuilder(List<List<User>> result)
 {
     _asyncUsersResult = new List<User>();
     foreach (var userResult in result)
     {
         _asyncUsersResult.InsertRange(0, userResult);   
     }
     Completion.Set();
 }
开发者ID:hywelandrews,项目名称:SoundCloud.Api.Net,代码行数:9,代码来源:UsersResourceTests.cs


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