示例#1
0
        public void CurrentTimeStep_IncrementedOnTick()
        {
            TimedGraph <Guid> graph = new TimedGraph <Guid>(identProvider, 10);

            graph.Tick();
            Assert.AreEqual(1, graph.CurrentTimeStep);
        }
示例#2
0
        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));
        }
示例#3
0
        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));
        }
示例#4
0
        public void AddTimedVertex_ExceptionIfNull()
        {
            TimedGraph <Guid> graph = new TimedGraph <Guid>(identProvider, 20);

            graph.AddTimedVertex(null);
        }
示例#5
0
        public void Tick_StepParam_ExceptionWhenParamTooLarge()
        {
            TimedGraph <Guid> graph = new TimedGraph <Guid>(identProvider, 20);

            graph.Tick(21);
        }
示例#6
0
        public void Tick_NoParam_Exception_WhenTimestepExceedsMax()
        {
            TimedGraph <Guid> graph = new TimedGraph <Guid>(identProvider, 0);

            graph.Tick();
        }
示例#7
0
        public void CurrentTimeStep_Is0AfterConstruction()
        {
            TimedGraph <Guid> graph = new TimedGraph <Guid>(identProvider, 10);

            Assert.AreEqual(0, graph.CurrentTimeStep);
        }