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


C# Framework.List类代码示例

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


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

示例1: SetupInformClientOfNeighbourTriggersNeighbourClientCreate

        /// <summary>
        /// Set up correct handling of the InformClientOfNeighbour call from the source region that triggers the
        /// viewer to setup a connection with the destination region.
        /// </summary>
        /// <param name='tc'></param>
        /// <param name='neighbourTcs'>
        /// A list that will be populated with any TestClients set up in response to 
        /// being informed about a destination region.
        /// </param>
        public static void SetupInformClientOfNeighbourTriggersNeighbourClientCreate(
            TestClient tc, List<TestClient> neighbourTcs)
        {
            // XXX: Confusingly, this is also used for non-neighbour notification (as in teleports that do not use the
            // event queue).

            tc.OnTestClientInformClientOfNeighbour += (neighbourHandle, neighbourExternalEndPoint) =>
            {
                uint x, y;
                Utils.LongToUInts(neighbourHandle, out x, out y);
                x /= Constants.RegionSize;
                y /= Constants.RegionSize;

                m_log.DebugFormat(
                    "[TEST CLIENT]: Processing inform client of neighbour located at {0},{1} at {2}", 
                    x, y, neighbourExternalEndPoint);

                AgentCircuitData newAgent = tc.RequestClientInfo();

                Scene neighbourScene;
                SceneManager.Instance.TryGetScene(x, y, out neighbourScene);

                TestClient neighbourTc = new TestClient(newAgent, neighbourScene);
                neighbourTcs.Add(neighbourTc);
                neighbourScene.AddNewAgent(neighbourTc, PresenceType.User);
            };
        }
开发者ID:Michelle-Argus,项目名称:opensim,代码行数:36,代码来源:EntityTransferHelpers.cs

示例2: TestRoundTrip_Assign02

        public void TestRoundTrip_Assign02()
        {
            //=================================
            // 1. Build AST 
            // 2. Execute AST and verify
            // 3. Convert AST to source
            // 4. Execute source and verify
            //=================================

            int result1 = 30;
            ExecutionMirror mirror = null;

            // 1. Build the AST tree
            ProtoCore.AST.AssociativeAST.BinaryExpressionNode assign = new ProtoCore.AST.AssociativeAST.BinaryExpressionNode(
                new ProtoCore.AST.AssociativeAST.IdentifierNode("a"),
                new ProtoCore.AST.AssociativeAST.BinaryExpressionNode(
                    new ProtoCore.AST.AssociativeAST.IntNode(10),
                    new ProtoCore.AST.AssociativeAST.IntNode(20),
                    ProtoCore.DSASM.Operator.add),
                ProtoCore.DSASM.Operator.assign);
            List<ProtoCore.AST.AssociativeAST.AssociativeNode> astList = new List<ProtoCore.AST.AssociativeAST.AssociativeNode>();
            astList.Add(assign);

            // 2. Execute AST and verify
            mirror = thisTest.RunASTSource(astList);
            Assert.IsTrue((Int64)mirror.GetValue("a").Payload == result1);

            // 3. Convert AST to source
            ProtoCore.CodeGenDS codegenDS = new ProtoCore.CodeGenDS(astList);
            string code = codegenDS.GenerateCode();

            // 4. Execute source and verify
            mirror = thisTest.RunScriptSource(code);
            Assert.IsTrue((Int64)mirror.GetValue("a").Payload == result1);
        }
开发者ID:limrzx,项目名称:Dynamo,代码行数:35,代码来源:RoundTripTests.cs

示例3: TestConcurrentQueueDeclare

        public void TestConcurrentQueueDeclare()
        {
            string x = GenerateExchangeName();
            Random rnd = new Random();

            List<Thread> ts = new List<Thread>();
            System.NotSupportedException nse = null;
            for(int i = 0; i < 256; i++)
            {
                Thread t = new Thread(() =>
                        {
                            try
                            {
                                // sleep for a random amount of time to increase the chances
                                // of thread interleaving. MK.
                                Thread.Sleep(rnd.Next(5, 500));
                                Model.ExchangeDeclare(x, "fanout", false, false, null);
                            } catch (System.NotSupportedException e)
                            {
                                nse = e;
                            }
                        });
                ts.Add(t);
                t.Start();
            }

            foreach (Thread t in ts)
            {
                t.Join();
            }

            Assert.IsNotNull(nse);
            Model.ExchangeDelete(x);
        }
开发者ID:hanxinimm,项目名称:rabbitmq-dotnet-client,代码行数:34,代码来源:TestExchangeDeclare.cs

示例4: CreateAndDisposeParentChildLoop

            public void CreateAndDisposeParentChildLoop()
            {
                var parent = new Parent { Child = new Child("c") };
                parent.Child.Parent = parent;
                Assert.AreSame(parent, parent.Child.Parent);
                Assert.AreSame(parent.Child, parent.Child.Parent.Child);
                var propertyChanges = new List<string>();
                var changes = new List<EventArgs>();
                var tracker = Track.Changes(parent, ReferenceHandling.Structural);
                tracker.PropertyChanged += (_, e) => propertyChanges.Add(e.PropertyName);
                tracker.Changed += (_, e) => changes.Add(e);
                Assert.AreEqual(0, tracker.Changes);
                CollectionAssert.IsEmpty(propertyChanges);
                CollectionAssert.IsEmpty(changes);

                tracker.Dispose();
                Assert.AreEqual(0, tracker.Changes);
                CollectionAssert.IsEmpty(propertyChanges);
                CollectionAssert.IsEmpty(changes);

                parent.Name += "abc";
                Assert.AreEqual(0, tracker.Changes);
                CollectionAssert.IsEmpty(propertyChanges);
                CollectionAssert.IsEmpty(changes);

                parent.Child.Name += "abc";
                Assert.AreEqual(0, tracker.Changes);
                CollectionAssert.IsEmpty(propertyChanges);
                CollectionAssert.IsEmpty(changes);
            }
开发者ID:JohanLarsson,项目名称:Gu.State,代码行数:30,代码来源:ChangeTrackerTests.ReferenceLoops.cs

示例5: Setup

        public void Setup()
        {
            var assembly = Assembly.GetExecutingAssembly();
            var resource = "All.com.robobat.UnitTests.TxtFiles.JSONBreakingBadShow.txt";
            using (Stream stream = assembly.GetManifestResourceStream(resource))
            using (StreamReader reader = new StreamReader(stream))
            {
                _FULLSHOWJSON = reader.ReadToEnd();
            }

            JSONParserForTMDB myParser = new JSONParserForTMDB(_FULLSHOWJSON);

            _FULLJSONSEASONLIST = new List<string>();

            for (int i = 1; i <= 5; i++)
            {
                resource = "All.com.robobat.UnitTests.TxtFiles.JSONBreakingBadSeason" + i + ".txt";
                using (Stream stream = assembly.GetManifestResourceStream(resource))
                using (StreamReader reader = new StreamReader(stream))
                {
                    _FULLJSONSEASONLIST.Add(reader.ReadToEnd());
                }
            }

            myParser.PopulateSeasonsFromJsonList(_FULLJSONSEASONLIST);
            _myShow = myParser.show;
        }
开发者ID:patrickpetropoulos,项目名称:TrakkerApp,代码行数:27,代码来源:TVShowUnitTests.cs

示例6: AssertImportTwoDifferentRecordsResults

 public void AssertImportTwoDifferentRecordsResults(List<CdrTaRecord> details, 
     CdrRtdRecord record1, CdrRtdRecord record2)
 {
     AssertResultsWithTwoDetails(details, record1, record2);
     AssertDistributionParameters(details[0], record1);
     AssertDistributionParameters(details[1], record2);
 }
开发者ID:ouyh18,项目名称:LteTools,代码行数:7,代码来源:ImportCdrTaRecordsServiceTestHelper.cs

示例7: VirtualIds

        public void VirtualIds()
        {
            const int BOX1ID = 22;
            const int BOX2ID = 23;
            const int ATTEMPTS = 1000;
            // store ids
            List<long> b1 = new List<long>(ATTEMPTS);
            List<long> b2 = new List<long>(ATTEMPTS);
            // create a new tracker with virtual id represent my book
            it = new IdTracker(BOX1ID);
            // create a second tracker with unique id
            IdTracker it2 = new IdTracker(BOX2ID);
            // make sure consequetive assignments don't match
            Assert.AreNotEqual(it.AssignId, it.AssignId);
            // make sure checks of ids do match
            Assert.AreEqual(it.NextId, it.NextId);
            // assign 1000 ids to make sure we overlap with tracker2 initial id
            for (int i = 0; i < ATTEMPTS; i++)
            {
                b1.Add(it.AssignId);
            }
            // assign 1000 ids to make sure we overlap with tracker1 assignments
            for (int i = 0; i < ATTEMPTS; i++)
            {
                b2.Add(it2.AssignId);
            }
            bool overlap = false;
            // test for id overlap
            for (int i = 0; i < ATTEMPTS; i++)
                for (int j = 0; j < ATTEMPTS; j++)
                    overlap |= (b1[i] == b2[j]);
            Assert.IsFalse(overlap, "ids overlapped");

        }
开发者ID:bluejack2000,项目名称:core,代码行数:34,代码来源:TestIdTracker.cs

示例8: SetUp

        public void SetUp()
        {
            _store = NewDocumentStore();
            _store.Initialize();

            // We first have to create the static indexes
            IndexCreation.CreateIndexes(typeof(Player_Index_R03).Assembly, _store);

            _teams = DataGenerator.CreateTeamList();

            // Store some players and teams in the database
            using (var session = _store.OpenSession())
            {
                foreach (var team in _teams)
                {
                    session.Store(team);
                }

                _players = DataGenerator.CreatePlayerListWithTeamIds();

                foreach (var player in _players)
                {
                    session.Store(player);
                }

                session.SaveChanges();
            }

            // Let's wait for indexing to happen
            // this method is part of RavenTestBase and thus should only be used in tests
            WaitForIndexing(_store);
        }
开发者ID:Zuehlke,项目名称:ravendb-workshop,代码行数:32,代码来源:R09_LoadDocumentInIndex.cs

示例9: GivenXdocumentWhenReadThenDlvAndPtnsAreMapped

        public void GivenXdocumentWhenReadThenDlvAndPtnsAreMapped()
        {
            _memStream = new MemoryStream();
            using (var xmlWriter = XmlWriter.Create(_memStream, new XmlWriterSettings { Encoding = new UTF8Encoding(false) }))
            {
                xmlWriter.WriteStartElement("TIM");
                xmlWriter.WriteStartElement("PTN");
                xmlWriter.WriteEndElement();
                xmlWriter.WriteStartElement("DLV");
                xmlWriter.WriteEndElement();
                xmlWriter.WriteStartElement("DLV");
                xmlWriter.WriteEndElement();
                xmlWriter.WriteStartElement("DLV");
                xmlWriter.WriteEndElement();
                xmlWriter.WriteEndElement();
                xmlWriter.Flush();
                xmlWriter.Close();
            }

            var xpathDoc = CreateXDoc();

            var ptn = new PTN();
            _ptnReaderMock.Setup(x => x.Read(It.IsAny<XPathNodeIterator>())).Returns(new List<PTN> { ptn });

            var dlvs = new List<DLV> { new DLV(), new DLV(), new DLV() };
            _dlvReaderMock.Setup(x => x.Read(It.Is<XPathNodeIterator>(y => y.Count == 3))).Returns(dlvs);

            var result = _timReader.Read(xpathDoc).First();
            Assert.AreSame(ptn, result.Items[0]);
            Assert.AreSame(dlvs[0], result.Items[1]);
            Assert.AreSame(dlvs[1], result.Items[2]);
            Assert.AreSame(dlvs[2], result.Items[3]);
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:33,代码来源:TimReaderTest.cs

示例10: LoadContent

        protected override async Task LoadContent()
        {
            await base.LoadContent();

            wireframeState = new RasterizerStateDescription(CullMode.Back) { FillMode = FillMode.Wireframe };

            simpleEffect = new EffectInstance(new Effect(GraphicsDevice, SpriteEffect.Bytecode));

            // TODO GRAPHICS REFACTOR
            simpleEffect.Parameters.Set(TexturingKeys.Texture0, UVTexture);
            simpleEffect.UpdateEffect(GraphicsDevice);

            primitives = new List<GeometricPrimitive>();

            // Creates all primitives
            primitives = new List<GeometricPrimitive>
                             {
                                 GeometricPrimitive.Plane.New(GraphicsDevice),
                                 GeometricPrimitive.Cube.New(GraphicsDevice),
                                 GeometricPrimitive.Sphere.New(GraphicsDevice),
                                 GeometricPrimitive.GeoSphere.New(GraphicsDevice),
                                 GeometricPrimitive.Cylinder.New(GraphicsDevice),
                                 GeometricPrimitive.Torus.New(GraphicsDevice),
                                 GeometricPrimitive.Teapot.New(GraphicsDevice),
                                 GeometricPrimitive.Capsule.New(GraphicsDevice, 0.5f, 0.3f),
                                 GeometricPrimitive.Cone.New(GraphicsDevice)
                             };


            view = Matrix.LookAtRH(new Vector3(0, 0, 5), new Vector3(0, 0, 0), Vector3.UnitY);

            Window.AllowUserResizing = true;
        }
开发者ID:cg123,项目名称:xenko,代码行数:33,代码来源:TestGeometricPrimitives.cs

示例11: AllSimpleTests

        public void AllSimpleTests()
        {
            var defaultProvider = MakeDefaultProvider();
            var simpleTests = Directory.GetFiles(
                Path.GetFullPath(Path.Combine(ComparisonTest.TestSourceFolder, "SimpleTestCases")),
                "*.cs"
            );
            var failureList = new List<string>();

            foreach (var filename in simpleTests) {
                Console.Write("// {0} ... ", Path.GetFileName(filename));

                try {
                    // We reuse the same type info provider for all the tests in this folder so they run faster
                    using (var test = new ComparisonTest(filename, null, defaultProvider))
                        test.Run();
                } catch (Exception ex) {
                    failureList.Add(Path.GetFileNameWithoutExtension(filename));
                    if (ex.Message == "JS test failed")
                        Debug.WriteLine(ex.InnerException);
                    else
                        Debug.WriteLine(ex);
                }
            }

            Assert.AreEqual(0, failureList.Count,
                String.Format("{0} test(s) failed:\r\n{1}", failureList.Count, String.Join("\r\n", failureList.ToArray()))
            );
        }
开发者ID:robashton,项目名称:JSIL,代码行数:29,代码来源:ComparisonTests.cs

示例12: GenerateFullManifest

 public void GenerateFullManifest()
 {
     ManifestGenerator generator = new ManifestGenerator();
     IntegrationRequest request = new IntegrationRequest(BuildCondition.ForceBuild, "Somewhere", null);
     IntegrationSummary summary = new IntegrationSummary(IntegrationStatus.Success, "A Label", "Another Label", new DateTime(2009, 1, 1));
     IntegrationResult result = new IntegrationResult("Test project", "Working directory", "Artifact directory", request, summary);
     Modification modification1 = GenerateModification("first file", "Add");
     Modification modification2 = GenerateModification("second file", "Modify");
     result.Modifications = new Modification[] { modification1, modification2 };
     List<string> files = new List<string>();
     files.Add("first file");
     XmlDocument manifest = generator.Generate(result, files.ToArray());
     Assert.IsNotNull(manifest);
     string actualManifest = manifest.OuterXml;
     string expectedManifest = "<manifest>"  +
             "<header project=\"Test project\" label=\"A Label\" build=\"ForceBuild\" status=\"Unknown\">" +
                 "<modification user=\"johnDoe\" changeNumber=\"1\" time=\"2009-01-01T00:00:00\">" +
                     "<comment>A comment</comment>" +
                     "<file name=\"first file\" type=\"Add\" />" +
                     "<file name=\"second file\" type=\"Modify\" />" +
                 "</modification>" +
             "</header>" +
             "<file name=\"first file\" />" +
         "</manifest>";
     Assert.AreEqual(expectedManifest, actualManifest);
 }
开发者ID:kyght,项目名称:CruiseControl.NET,代码行数:26,代码来源:ManifestGeneratorTests.cs

示例13: TestRollingEventSequence

        static void TestRollingEventSequence(
            IEnumerable<LogEvent> events,
            int? retainedFiles,
            Action<IList<string>> verifyWritten)
        {
            var fileName = Some.String() + "-{Date}.txt";
            var folder = Some.TempFolderPath();
            var pathFormat = Path.Combine(folder, fileName);

            var log = new LoggerConfiguration()
                .WriteTo.RollingFile(pathFormat, retainedFileCountLimit: retainedFiles)
                .CreateLogger();

            var verified = new List<string>();

            try
            {
                foreach (var @event in events)
                {
                    Clock.SetTestDateTimeNow(@event.Timestamp.DateTime);
                    log.Write(@event);

                    var expected = pathFormat.Replace("{Date}", @event.Timestamp.ToString("yyyyMMdd"));
                    Assert.That(File.Exists(expected));

                    verified.Add(expected);
                }
            }
            finally
            {
                ((IDisposable)log).Dispose();
                verifyWritten(verified);
                Directory.Delete(folder, true);
            }
        }
开发者ID:NikolaR,项目名称:serilog,代码行数:35,代码来源:RollingFileSinkTests.cs

示例14: test1

        public void test1()
        {
            UndirectedGraph<int, Edge<int>> graph = new UndirectedGraph<int, Edge<int>>(true);

            // Add vertices to the graph
            graph.AddVertex(0);
            graph.AddVertex(1);
            graph.AddVertex(2);
            graph.AddVertex(3);
            // Create the edges
            Edge<int> e0_1 = new Edge<int>(0, 1);
            Edge<int> e0_2 = new Edge<int>(0, 2);
            Edge<int> e1_2 = new Edge<int>(1, 2);
            Edge<int> e1_3 = new Edge<int>(1, 3);
            // Add the edges
            graph.AddEdge(e0_1);
            graph.AddEdge(e0_2);
            graph.AddEdge(e1_2);
            graph.AddEdge(e1_3);

            List<int> path = new List<int>();

            HamiltonianDefiner definer = new HamiltonianDefiner(graph);
            bool isHamiltonian = definer.isHamiltonianGraph(path);
            Assert.AreEqual(isHamiltonian, false);
        }
开发者ID:DmitriyChernov,项目名称:HomeWork,代码行数:26,代码来源:UnitTest1.cs

示例15: SetPlayers_ShouldAddPlayers

        public void SetPlayers_ShouldAddPlayers()
        {
            var players = new List<string>() { "Horse", "Car"};

            gameBuilder.SetPlayers(players);
            Assert.That(gameBuilder.GetGame().Players, Is.EquivalentTo(players));
        }
开发者ID:neoprincie,项目名称:MonopolyKata,代码行数:7,代码来源:ClassicMonopolyBuilderTests.cs


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