public void TestItemRetrieval() { PriorityItemPair<int, string> testPair = new PriorityItemPair<int, string>( 12345, "hello world" ); Assert.AreEqual("hello world", testPair.Item); }
public void TestToStringWithValidStrings() { PriorityItemPair<string, string> testPair = new PriorityItemPair<string, string>( "hello", "world" ); Assert.AreEqual("[hello, world]", testPair.ToString()); }
public void TestToStringWithNullStrings() { PriorityItemPair<ToStringNullReturner, ToStringNullReturner> testPair = new PriorityItemPair<ToStringNullReturner, ToStringNullReturner>( new ToStringNullReturner(), new ToStringNullReturner() ); Assert.AreEqual("[, ]", testPair.ToString()); }
public void TestCopyTo() { PairPriorityQueue<float, string> testQueue = new PairPriorityQueue<float, string>(); testQueue.Enqueue(1.0f, "a"); testQueue.Enqueue(9.0f, "i"); testQueue.Enqueue(2.0f, "b"); testQueue.Enqueue(8.0f, "h"); testQueue.Enqueue(3.0f, "c"); testQueue.Enqueue(7.0f, "g"); testQueue.Enqueue(4.0f, "d"); testQueue.Enqueue(6.0f, "f"); testQueue.Enqueue(5.0f, "e"); PriorityItemPair<float, string>[] itemArray = new PriorityItemPair<float, string>[9]; testQueue.CopyTo(itemArray, 0); CollectionAssert.AreEquivalent(testQueue, itemArray); }