[10450] | 1 | using Microsoft.VisualStudio.TestTools.UnitTesting;
|
---|
| 2 |
|
---|
| 3 | namespace 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>();
|
---|
[10454] | 34 | queue.Push(5, new DummyAction());
|
---|
[10450] | 35 | Assert.IsTrue(queue.Count == 1);
|
---|
[10454] | 36 | queue.Push(2, new DummyAction());
|
---|
[10450] | 37 | Assert.IsTrue(queue.Peek().Time == 2);
|
---|
| 38 | Assert.IsTrue(queue.Count == 2);
|
---|
[10454] | 39 | queue.Push(3, new DummyAction());
|
---|
[10450] | 40 | Assert.IsTrue(queue.Peek().Time == 2);
|
---|
| 41 | Assert.IsTrue(queue.Count == 3);
|
---|
| 42 | for (var i = 10; i < 50; i++)
|
---|
[10454] | 43 | queue.Push(i, new DummyAction());
|
---|
[10450] | 44 | Assert.IsTrue(queue.Peek().Time == 2);
|
---|
| 45 | Assert.IsTrue(queue.Count == 43);
|
---|
[10454] | 46 | queue.Push(2, new DummyAction());
|
---|
[10450] | 47 | }
|
---|
| 48 | }
|
---|
| 49 | }
|
---|