Free cookie consent management tool by TermsFeed Policy Generator

source: branches/SimulationCore/HeuristicLab.SimulationCore.Tests/EventQueueTest.cs @ 11868

Last change on this file since 11868 was 10454, checked in by abeham, 11 years ago

#1610: updated core, implemented card game sample

File size: 1.5 KB
Line 
1using Microsoft.VisualStudio.TestTools.UnitTesting;
2
3namespace HeuristicLab.SimulationCore.Tests {
4  /// <summary>
5  /// Summary description for FibonacciHeapTest
6  /// </summary>
7  [TestClass]
8  public class EventQueueTest {
9    private class DummyAction : IAction<IModel> {
10      public System.Guid ActionId {
11        get { throw new System.NotImplementedException(); }
12      }
13
14      public IActivity<IModel> Mandate {
15        get { throw new System.NotImplementedException(); }
16      }
17
18      public void Execute(IModel model) {
19        throw new System.NotImplementedException();
20      }
21
22      public Common.IDeepCloneable Clone(Common.Cloner cloner) {
23        throw new System.NotImplementedException();
24      }
25
26      public object Clone() {
27        throw new System.NotImplementedException();
28      }
29    }
30
31    [TestMethod]
32    public void EventQueueCreateTest() {
33      var queue = new SortedListEventQueue<IModel>();
34      queue.Push(5, new DummyAction());
35      Assert.IsTrue(queue.Count == 1);
36      queue.Push(2, new DummyAction());
37      Assert.IsTrue(queue.Peek().Time == 2);
38      Assert.IsTrue(queue.Count == 2);
39      queue.Push(3, new DummyAction());
40      Assert.IsTrue(queue.Peek().Time == 2);
41      Assert.IsTrue(queue.Count == 3);
42      for (var i = 10; i < 50; i++)
43        queue.Push(i, new DummyAction());
44      Assert.IsTrue(queue.Peek().Time == 2);
45      Assert.IsTrue(queue.Count == 43);
46      queue.Push(2, new DummyAction());
47    }
48  }
49}
Note: See TracBrowser for help on using the repository browser.