|
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using MVPChainingFactory.Factory;
namespace MVPChainingFactory.Tests
{
[TestFixture]
public class LinkedListFixture
{
PresenterSkeletonChain l;
string[] expected;
[SetUp]
public void Setup()
{
l = new PresenterSkeletonChain();
l.AddLast(new PresenterSkeleton(typeof(int)));
l.AddLast(new PresenterSkeleton(typeof(double)));
l.AddLast(new PresenterSkeleton(typeof(float)));
// Specify HEAD
l.AddFirst(new PresenterSkeleton(typeof(string)));
// Specify TAIL
l.AddLast(new PresenterSkeleton(typeof(object)));
// if l.Last == Tail => AddBefore(Last)
l.AddBefore(l.Last, new PresenterSkeleton(typeof(Console)));
expected = new string[]
{
"System.String",
"System.Int32",
"System.Double",
"System.Single",
"System.Console",
"System.Object"
};
}
[Test]
public void TestAdd()
{
PrintList(l);
int i = 0;
foreach (PresenterSkeleton item in l) {
Assert.AreEqual(expected[i], item.PresenterType.FullName);
i++;
}
}
[Test]
public void TestNodeIterator()
{
int i = 0;
foreach (LinkedListNode<PresenterSkeleton> node in l.Nodes)
{
Assert.AreEqual(expected[i], node.Value.PresenterType.FullName);
i++;
}
}
private static void PrintList(PresenterSkeletonChain l)
{
foreach (PresenterSkeleton val in l)
Console.WriteLine(val.PresenterType.FullName);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
I am a tech lead working for Cap Gemini. Although I primarily work with the Microsoft technology stack (including .NET and legacy technologies) I like to keep myself informed about developments in the Java world.