|
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using MVCSharp.Core.Configuration.Views;
namespace MVCSharp.Tests.Core.Configuration.Views
{
[TestFixture]
public class TestViewInfosByTaskCollection
{
ViewInfosByTaskCollection vibtColl;
[SetUp]
public void TestSetup()
{
vibtColl = new ViewInfosByTaskCollection();
vibtColl[typeof(int)] = new ViewInfoCollection();
vibtColl[typeof(string)] = new ViewInfoCollection();
}
[Test]
public void TestCount()
{
Assert.AreEqual(2, vibtColl.Count);
}
[Test]
public void TestAddColl()
{
ViewInfosByTaskCollection vibtColl2 = new ViewInfosByTaskCollection();
vibtColl2[typeof(decimal)] = new ViewInfoCollection();
vibtColl2[typeof(long)] = new ViewInfoCollection();
vibtColl.Add(vibtColl2);
Assert.AreEqual(4, vibtColl.Count);
Assert.AreSame(vibtColl2[typeof(decimal)], vibtColl[typeof(decimal)]);
Assert.AreSame(vibtColl2[typeof(long)], vibtColl[typeof(long)]);
}
[Test]
public void TestEnumerate()
{
bool containsFirst = false, containsSecond = false;
int count = 0;
foreach (Type t in vibtColl)
{
if (t == typeof(int))
containsFirst = true;
else if (t == typeof(string))
containsSecond = true;
count++;
}
Assert.AreEqual(2, count);
Assert.IsTrue(containsFirst && containsSecond);
}
}
}
|
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.
Oleg Zhukov, born and living in Russia is Lead Engineer and Project Manager in a company which provides business software solutions. He has graduated from Moscow Institute of Physics and Technology (MIPT) (department of system programming) and has got a M.S. degree in applied physics and mathematics. His research and development work concerns architectural patterns, domain-driven development and systems analysis. Being the adherent of agile methods he applies them extensively in the projects managed by him.