public void ItShouldNotReappear() { var queue = new ActorQueueManager(10); var obj = new GameElement("A", 10); // act queue.Add(obj); // assert queue.PopNext().Should().NotBeNull(); queue.PopNext().Should().BeNull(); }
public void ItShouldReappear() { var queue = new ActorQueueManager(10); var obj = new GameElement("A", 10); // act queue.Register(obj); // assert for (var i = 0; i < 2; i++) { queue.PopNext().Should() .NotBeNull(); } }
public void ProcessingTest() { var qm = new ActorQueueManager(10); var beastA = new GameElement("A", 5); var beastB1 = new GameElement("B1", 10); var beastB2 = new GameElement("B2", 10); var beastB3 = new GameElement("B3", 5); var beastC = new GameElement("C", 15); qm.Register(beastA); qm.Register(beastB1); qm.Register(beastB2); qm.Register(beastB3); qm.Register(beastC); for (var i = 0; i < 10000; i++) { var next = qm.PopNext(); } }
public void TheyShouldAppearAccordingToSpeed() { var queue = new ActorQueueManager(10); var obj1 = new GameElement("A", 10); var obj2 = new GameElement("B", 5); // act - order is important queue.Register(obj2); queue.Register(obj1); // assert queue.PopNext().Speed.Should().Be(5); queue.PopNext().Speed.Should().Be(10); queue.PopNext().Speed.Should().Be(5); queue.Turn.Should().Be(1); // next turn starts queue.PopNext().Speed.Should().Be(5); queue.Turn.Should().Be(2); queue.PopNext().Speed.Should().Be(10); queue.PopNext().Speed.Should().Be(5); }