コード例 #1
0
ファイル: TimedGraph.tests.cs プロジェクト: AP-Hunt/Evolve2
        public void AddTimedVertex_PresentAtStep2_NotInVertexSetAtStep0()
        {
            Func <Graph <Guid>, int, IEnumerable <Guid>, bool> presentAt2 =
                (g, t, e) => t == 2;

            TimedGraph <Guid>  graph = new TimedGraph <Guid>(identProvider, 5);
            TimedVertex <Guid> tv    = new TimedVertex <Guid>(identProvider, presentAt2);

            graph.AddTimedVertex(tv);

            Assert.IsFalse(graph.Vertices.Contains(tv));
        }
コード例 #2
0
ファイル: TimedVertex.tests.cs プロジェクト: AP-Hunt/Evolve2
        public void Presence_UsesAnonymousFunction()
        {
            TimedVertex <Guid> tv = new TimedVertex <Guid>(identProvider,
                                                           Present: (g, t, e) => t == 5);

            TimedGraph <Guid> graph = new TimedGraph <Guid>(identProvider, 10);

            graph.AddTimedVertex(tv);

            Assert.AreEqual(0, graph.CurrentTimeStep);
            Assert.IsFalse(tv.IsPresentAt(graph, graph.CurrentTimeStep));

            graph.Tick(5);
            Assert.AreEqual(5, graph.CurrentTimeStep);
            Assert.IsTrue(tv.IsPresentAt(graph, graph.CurrentTimeStep));
        }