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


C# List.ToString方法代码示例

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


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

示例1: AllUIItemsHaveDefaultConstructor

 public void AllUIItemsHaveDefaultConstructor()
 {
     var collection = new List<string>();
     AllSubsclassesHaveEmptyConstructor(collection, typeof(UIItem));
     AllSubsclassesHaveEmptyConstructor(collection, typeof(SearchCondition));
     AllSubsclassesHaveEmptyConstructor(collection, typeof(SearchCriteria));
     AllSubsclassesHaveEmptyConstructor(collection, typeof(AutomationElementProperty));
     Assert.AreEqual(0, collection.Count, collection.ToString());
 }
开发者ID:shiftkey,项目名称:White,代码行数:9,代码来源:CoreProjectTest.cs

示例2: TestGetMinion

 public void TestGetMinion()
 {
     Villain test = ObjectMother.TestVillain();
     test.addMinion(ObjectMother.TestMinion());
     List<Minion> testList = new List<Minion>();
     testList.Add(ObjectMother.TestMinion());
     List<Minion> actual = test.getMinions();
     Assert.AreEqual(actual.ToString(), testList.ToString());
 }
开发者ID:vattercw,项目名称:SentinelsOfTheMultiverse,代码行数:9,代码来源:VillainTest.cs

示例3: Hand_TestToString_CheckIfCorrectInput

        public void Hand_TestToString_CheckIfCorrectInput()
        {
            var listOfCards = new List<ICard>();
            while (listOfCards.Count==10)
            {
                listOfCards.Add(new Card(new CardFace(), new CardSuit()));
            }

            Assert.IsNotEmpty(listOfCards.ToString());
        }
开发者ID:Xristinaaaa,项目名称:Telerik2016,代码行数:10,代码来源:HandTests.cs

示例4: LetsGetSomeMatchesGoingOn

        public void LetsGetSomeMatchesGoingOn()
        {
            var users = new List<User>();

            var filler = new Filler();
            filler.Configure<Bar>().Defaults();
            filler.Configure<Foo>(config =>
            {
                config.For(foo => foo.Bars).Times(Constants.Random.Next(100));
                config.For(foo => foo.Age).Use(new RandomWholeNumberGenerator(10, 21)).Order(1);
                config.For(foo => foo.CalculatedAge).Do(context => context.CurrentAs<Foo>().Age + 20).Order(2);
            }).Defaults();

            filler.Configure<Goo>().Defaults();
            filler.Configure<User>().Defaults();
            filler.Configure<AllowedPartner>(config =>
            {
                config.For(allowedPartner => allowedPartner.MinAge).Use(new MinAgeGenerator());
                config.For(allowedPartner => allowedPartner.MaxAge).Use(new MaxAgeGenerator());
            });

            1000.Times(() => users.Add(filler.Fill(new User())));
            users.ToString();
        }
开发者ID:chrisjowen,项目名称:FillMe,代码行数:24,代码来源:ComplexDependenciesTests.cs

示例5: testLargeBulkInsert

        public void testLargeBulkInsert()
        {
            IDBCollection c = Mongo.DefaultDatabase.GetCollection("largebulk");
            c.Drop();
            string test = "asdasdasd";
            while (test.Length < 10000)
                test += test;
            List<IDBObject> l = new List<IDBObject>();
            int num = 3 * (Bytes.MAX_OBJECT_SIZE / test.Length);

            for (int t = 0; t < num; t++)
            {
                l.Add(new Document("test", t));
            }
            Assert.AreEqual(0, c.Find().Count());
            c.Insert(new Document("l",l));
            Assert.AreEqual(num, c.Find().Count());

            test = l.ToString();
            Assert.IsTrue(test.Length > Bytes.MAX_OBJECT_SIZE);
            Assert.That(()=> c.Save(new Document("foo", test)), Throws.Exception);
            Assert.AreEqual(num, c.Find().Count());
        }
开发者ID:cole2295,项目名称:mongodb-net,代码行数:23,代码来源:IDBCollectionTests.cs

示例6: GetTemplatesTests

        public void GetTemplatesTests()
        {
            const string foo1 = "{{foo|a}}", foo2 = "{{foo|b}}";
            string text = @"now " + foo1 + " and " + foo2;

            Regex foo = new Regex(@"{{foo.*?}}");
            List<Match> fred = new List<Match>();

            foreach (Match m in foo.Matches(text))
                fred.Add(m);

            Assert.AreEqual(fred.ToString(), Parsers.GetTemplates(text, "foo").ToString());
            Assert.AreEqual(fred.ToString(), Parsers.GetTemplates(text, "Foo").ToString());
            List<Match> templates = Parsers.GetTemplates(text, "foo");
            Assert.AreEqual(foo1, templates[0].Value);
            Assert.AreEqual(foo2, templates[1].Value);
            Assert.AreEqual(2, templates.Count);

            // ignores commeted out templates
            templates = Parsers.GetTemplates(text + @" <!-- {{foo|c}} -->", "foo");
            Assert.AreEqual(foo1, templates[0].Value);
            Assert.AreEqual(foo2, templates[1].Value);
            Assert.AreEqual(2, templates.Count);

            // ignores nowiki templates
            templates = Parsers.GetTemplates(text + @" <nowiki> {{foo|c}} </nowiki>", "foo");
            Assert.AreEqual(foo1, templates[0].Value);
            Assert.AreEqual(foo2, templates[1].Value);
            Assert.AreEqual(2, templates.Count);

            // nested templates caught
            const string foo3 = @"{{ Foo|bar={{abc}}|beer=y}}";
            templates = Parsers.GetTemplates(@"now " + foo3 + @" there", "foo");
            Assert.AreEqual(foo3, templates[0].Value);

            // whitespace ignored
            const string foo4 = @"{{ Foo }}";
            templates = Parsers.GetTemplates(@"now " + foo4 + @" there", "foo");
            Assert.AreEqual(foo4, templates[0].Value);

            // no matches here
            templates = Parsers.GetTemplates(@"now " + foo3 + @" there", "fo");
            Assert.AreEqual(0, templates.Count);

            templates = Parsers.GetTemplates(@"{{test}}", "test");
            Assert.AreEqual(1, templates.Count);

            templates = Parsers.GetTemplates(@"{{test}}
", "test");
            Assert.AreEqual(1, templates.Count);
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:51,代码来源:ParserTests.cs

示例7: LoadDatedTemplates

        public void LoadDatedTemplates()
        {
            List<string> DatedTemplates = new List<string>();

            Assert.AreEqual(DatedTemplates, Parsers.LoadDatedTemplates(""), "returns empty list when no rules present");

            Assert.AreEqual(DatedTemplates, Parsers.LoadDatedTemplates("<!--{{tl|wikif-->"), "ignores commented out rules");

            DatedTemplates.Add("Wikify");
            Assert.AreEqual(DatedTemplates.ToString(), Parsers.LoadDatedTemplates(@"{{tl|wikify}}").ToString(), "loads single rule");

            DatedTemplates.Add("Citation needed");
            Assert.AreEqual(DatedTemplates.ToString(), Parsers.LoadDatedTemplates(@"{{tl|wikify}}
{{tl|citation needed}}").ToString(), "loads multiple rules");
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:15,代码来源:ParserTests.cs

示例8: TestToString

        public void TestToString()
        {
            var stringCollection = new List<string>
            {
                 "This",
                 "is",
                 "a",
                 "comma",
                 "seperated",
                 "list",

            };

            var emptyStringCollection = new List<string>();
            List<string> nullStringCollection = null;
            Assert.AreEqual("This,is,a,comma,seperated,list", stringCollection.ToString(""));
            Assert.AreEqual("This,is,a,comma,seperated,list", stringCollection.ToString("Base string: "));
            Assert.AreEqual("", emptyStringCollection.ToString("EMPTY"));
            // ReSharper disable once ExpressionIsAlwaysNull
            Assert.AreEqual("EMPTY", nullStringCollection.ToString("EMPTY"));
        }
开发者ID:i7clock,项目名称:OptiKey,代码行数:21,代码来源:StringExtensionsTests.cs

示例9: TestInjectImages_Trivial

        public void TestInjectImages_Trivial()
        {
            AlbumDescriptor ad = new AlbumDescriptor() 
            { Artist="ATeste",Name="Name1" };

            List<TrackDescriptor> lt = new List<TrackDescriptor>();
            lt.Add(new TrackDescriptor(){Name="T1",TrackNumber=47,Duration=TimeSpan.FromMinutes(2)});
            ad.RawTrackDescriptors = lt;

            lt.ToString().Should().NotBeNull();

            AlbumDescriptor ad2 = new AlbumDescriptor();
            ad.InjectImages(ad2,false);
            ad.RawImages.Should().BeNull();


            ad.InjectImages(null, false);
            ad.RawImages.Should().BeNull();
        }
开发者ID:David-Desmaisons,项目名称:MusicCollection,代码行数:19,代码来源:AlbumDescriptorTestor.cs

示例10: TestPipelineXMLSnippet

        public void TestPipelineXMLSnippet()
        {
            // SrcML sample method
            string srcmlOutput = @"<function><type><name> bool </name></type> <name> findInFiles </name><parameter_list> () </parameter_list>
                            <block>{
                                <decl_stmt><decl><type><specifier>const</specifier> <name>TCHAR</name> <modifier>*</modifier></type><name>dir2Search</name> <init>= <expr><call><name><name>_findReplaceDlg</name><operator>.</operator><name>getDir2Search</name></name><argument_list>()</argument_list></call></expr></init></decl>;</decl_stmt>

                                <expr_stmt><expr><call><name>findFilesInOut</name><argument_list>()</argument_list></call></expr>;</expr_stmt>
                                <if>if <condition>(<expr><operator>!</operator><name><name>dir2Search</name><index>[<expr><literal type=""number"">0</literal></expr>]</index></name> <operator>||</operator> <operator>!</operator><call><name><operator>::</operator><name>PathFileExists</name></name><argument_list>(<argument><expr><name>dir2Search</name></expr></argument>)</argument_list></call></expr>)</condition><then>
                                <block>{
                                    <return>return <expr><literal type = ""boolean"" > false </literal></expr>;</return>
                                }</block></then></if>
                                <decl_stmt><decl><type><name>string</name></type> <name>findString</name> <init>= <expr><literal type = ""string"" > """" </literal ></expr ></init ></decl >;</decl_stmt>

                                <expr_stmt><expr><call><name>gethurry</name><argument_list>()</argument_list></call></expr>;</expr_stmt>

                                <macro><name>findInOne</name><argument_list>(<argument>int a</argument>, <argument>findString</argument>)</argument_list></macro><empty_stmt>;</empty_stmt>

                                <decl_stmt><decl><type><name>bool</name></type> <name>isRecursive</name> <init>= <expr><call><name><name>_findReplaceDlg</name><operator >.</operator><name>isRecursive</name></name><argument_list>()</argument_list></call></expr></init></decl>;</decl_stmt>
                                <decl_stmt><decl><type><name>bool</name></type> <name>isInHiddenDir</name> <init>= <expr><call><name><name>_findReplaceDlg</name><operator >.</operator><name>isInHiddenDir</name></name><argument_list>()</argument_list></call></expr></init></decl>;</decl_stmt>

                                <if>if <condition>(<expr><call><name><name>a</name><operator >.</operator><name>size</name></name><argument_list>()</argument_list></call> <operator >==</operator> <literal type = ""number"" > 0 </literal></expr>)</condition><then>
                                <block>{
                                    <expr_stmt><expr><call><name><name>a</name><operator >.</operator><name>setFindInFilesDirFilter</name></name><argument_list>(<argument><expr><literal type = ""string""> ""dddd"" </literal ></expr ></argument>, <argument><expr><call><name>TEXT</name><argument_list>(<argument><expr><literal type = ""string"" > ""*.*"" </literal ></expr></argument>)</argument_list></call></expr></argument>)</argument_list></call></expr>;</expr_stmt>
                                    <expr_stmt><expr><call><name><name>a</name><operator >.</operator><name>getPatterns</name></name><argument_list>(<argument><expr><name>findString</name></expr></argument>)</argument_list></call></expr>;</expr_stmt>
                                }</block></then></if>
                                <return>return <expr><literal type = ""boolean"" > true </literal ></expr>;</return>
                            }</block></function>";

            // Convert raw string to MethodDefinition
            var fileSetup = new SrcMLFileUnitSetup(Language.CPlusPlus);
            var parser = new CPlusPlusCodeParser();

            var fileUnit = fileSetup.GetFileUnitForXmlSnippet(srcmlOutput, "sampletestmethods.cpp");
            var scope = parser.ParseFileUnit(fileUnit);

            var srcmlMethod = scope.GetDescendants<MethodDefinition>().First();

            // Verify the method definition
            Assert.IsInstanceOf<MethodDefinition>(srcmlMethod, "MethodDefinition found.");
            Console.WriteLine(srcmlMethod.ToString());

            // Extract SUnit Statements from MethodDefinition
            var statements = new List<Statement>();
            statements.AddRange(SUnitExtractor.ExtractEnding(srcmlMethod));
            statements.AddRange(SUnitExtractor.ExtractSameAction(srcmlMethod));
            statements.AddRange(SUnitExtractor.ExtractVoidReturn(srcmlMethod));

            // verify the statements selected
            Assert.IsNotEmpty(statements, "statements selected from method definition");
            Console.WriteLine(statements.ToString());

            // Translate Statements into SUnits
            List<SUnit> sunits = statements.ConvertAll(
                        new Converter<Statement, SUnit> (SUnitTranslator.Translate) );

            // verify sunits have been translated
            Assert.That(sunits.TrueForAll(s => s.action != null), "All SUnits initialized.");
            Console.WriteLine(sunits.ToString());

            // Generate text from SUnits
            List<string> sentences = sunits.ConvertAll(
                        new Converter<SUnit, string> (TextGenerator.GenerateText) );

            // verify string generated
            Assert.That(sentences.TrueForAll(s => s.Length > 0));
            Console.WriteLine(sentences);

            // Collect text and summarize
            var methodDocument = String.Join<string>(" ", sentences);
            var summary = Summarizer.Summarize(methodDocument);

            // verify summary
            Assert.That(! summary.Equals(""));
            Console.WriteLine(summary);
        }
开发者ID:herbertkb,项目名称:Swummary,代码行数:76,代码来源:TestPipeline.cs

示例11: ToString_EqualsName

		public void ToString_EqualsName()
		{
			var list = new List { Name = "a name" };

			Assert.That(list.ToString(), Is.EqualTo("a name"));
		}
开发者ID:pabloescribano,项目名称:Trello.NET,代码行数:6,代码来源:ListTests.cs

示例12: TestRandom


//.........这里部分代码省略.........
            {
                Document doc = new Document();
                doc.Add(NewStringField("content", testDoc.content, Field.Store.NO));
                testDoc.value = Random().NextFloat();
                doc.Add(new FloatDocValuesField("value", testDoc.value));
                for (int j = 0; j < numDims; j++)
                {
                    if (testDoc.dims[j] != null)
                    {
                        doc.Add(new FacetField("dim" + j, testDoc.dims[j]));
                    }
                }
                w.AddDocument(config.Build(tw, doc));
            }

            // NRT open
            IndexSearcher searcher = NewSearcher(w.Reader);

            // NRT open
            var tr = new DirectoryTaxonomyReader(tw);

            ValueSource values = new FloatFieldSource("value");

            int iters = AtLeast(100);
            for (int iter = 0; iter < iters; iter++)
            {
                string searchToken = tokens[Random().Next(tokens.Length)];
                if (VERBOSE)
                {
                    Console.WriteLine("\nTEST: iter content=" + searchToken);
                }
                FacetsCollector fc = new FacetsCollector();
                FacetsCollector.Search(searcher, new TermQuery(new Term("content", searchToken)), 10, fc);
                Facets facets = new TaxonomyFacetSumValueSource(tr, config, fc, values);

                // Slow, yet hopefully bug-free, faceting:
                var expectedValues = new List<Dictionary<string, float?>>();
                for (int i = 0; i < numDims; i++)
                {
                    expectedValues[i] = new Dictionary<string, float?>();
                }

                foreach (TestDoc doc in testDocs)
                {
                    if (doc.content.Equals(searchToken))
                    {
                        for (int j = 0; j < numDims; j++)
                        {
                            if (doc.dims[j] != null)
                            {
                                float? v = expectedValues[j][doc.dims[j]];
                                if (v == null)
                                {
                                    expectedValues[j][doc.dims[j]] = doc.value;
                                }
                                else
                                {
                                    expectedValues[j][doc.dims[j]] = (float)v + doc.value;
                                }
                            }
                        }
                    }
                }

                IList<FacetResult> expected = new List<FacetResult>();
                for (int i = 0; i < numDims; i++)
                {
                    IList<LabelAndValue> labelValues = new List<LabelAndValue>();
                    float totValue = 0;
                    foreach (KeyValuePair<string, float?> ent in expectedValues[i])
                    {
                        labelValues.Add(new LabelAndValue(ent.Key, ent.Value.Value));
                        totValue += ent.Value.Value;
                    }
                    SortLabelValues(labelValues);
                    if (totValue > 0)
                    {
                        expected.Add(new FacetResult("dim" + i, new string[0], totValue, labelValues.ToArray(), labelValues.Count));
                    }
                }

                // Sort by highest value, tie break by value:
                SortFacetResults(expected);

                IList<FacetResult> actual = facets.GetAllDims(10);

                // Messy: fixup ties
                SortTies(actual);

                if (VERBOSE)
                {
                    Console.WriteLine("expected=\n" + expected.ToString());
                    Console.WriteLine("actual=\n" + actual.ToString());
                }

                AssertFloatValuesEquals(expected, actual);
            }

            IOUtils.Close(w, tw, searcher.IndexReader, tr, indexDir, taxoDir);
        }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:101,代码来源:TestTaxonomyFacetSumValueSource.cs


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