public void On_Tick_use_provided_delta_seconds() { AddEntitiesToListEntityList(23); nextDeltaSeconds = 5f; processor = new TickableProcessorSpy(repository, deltaSecondsProvider); processor.Tick(); Assert.That(processor.AccumulatedDelta, Is.EqualTo(23 * nextDeltaSeconds)); }
public void When_node_added_is_processed_on_next_tick() { AddEntitiesToListEntityList(9); processor = new TickableProcessorSpy(repository, deltaSecondsProvider); processor.Tick(); Assert.That(processor.ProcessedNodes.Count, Is.EqualTo(9)); processor.ClearTest(); AddEntitiesToListEntityList(2); processor.Tick(); Assert.That(processor.ProcessedNodes.Count, Is.EqualTo(11)); }
public void When_node_removed_is_not_processed_on_next_tick() { AddEntitiesToListEntityList(9); processor = new TickableProcessorSpy(repository, deltaSecondsProvider); processor.Tick(); Assert.That(processor.ProcessedNodes.Count, Is.EqualTo(9)); processor.ClearTest(); entityList.RemoveEntity(entityList[0].entity); entityList.RemoveEntity(entityList[0].entity); processor.Tick(); Assert.That(processor.ProcessedNodes.Count, Is.EqualTo(7)); }
public void On_Tick_process_all_nodes() { AddEntitiesToListEntityList(10); processor = new TickableProcessorSpy(repository, deltaSecondsProvider); processor.Tick(); var i = 0; entityList.ForEach((cs) => { Assert.That(cs.component1, Is.EqualTo(processor.ProcessedNodes[i].myString)); Assert.That(cs.component2, Is.EqualTo(processor.ProcessedNodes[i].myInt)); i++; }); Assert.That(processor.ProcessedNodes.Count, Is.EqualTo(10)); }
public void On_Tick_calls_delta_seconds_provider_x_entity() { AddEntitiesToListEntityList(23); nextDeltaSeconds = 5f; deltaSecondsIncrement = 3f; float expectedAcummulatedSeconds = nextDeltaSeconds; for (var i = 1; i < 23; i++) { expectedAcummulatedSeconds += nextDeltaSeconds + deltaSecondsIncrement * i; } processor = new TickableProcessorSpy(repository, incrementalDeltaSecondsProvider); processor.Tick(); Assert.That(processor.AccumulatedDelta, Is.EqualTo(expectedAcummulatedSeconds)); }