MVCSharp
API Docs
CleanUpAll.proj
Examples
ASP.NET MVC Store
ApplicationLogic
Model
NorthwindDataSet.xsc
NorthwindDataSet.xss
Presentation
App_Data
Nwind.mdb
Site.Master
Properties
Tests
Properties
TestApplicationLogic
Tests.csproj.user
Basics
Basics (generics used)
ApplicationLogic
Model
Presentation
Web
Win
Properties
ApplicationLogic
Model
Presentation
Web
Win
Properties
SimpleFormsViewsManager
Properties
TestSimpleFormsViewsManager
ApplicationLogic
Presentation
Properties
TasksInteraction
ApplicationLogic
Model
Presentation
Web
Win
Properties
WindowsFormsExample
ApplicationLogic
Presentation
Properties
MVCSharp
MVCSharp.Tests
Core
Configuration
Tasks
Views
Tasks
MVCSharp.Tests.csproj.user
Properties
Webforms
Configuration
Winforms
Configuration
Core
Configuration
Tasks
Views
Tasks
Views
Properties
Webforms
Configuration
Winforms
Configuration
|
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 TestViewInfoCollection
{
ViewInfoCollection viColl;
[SetUp]
public void TestSetup()
{
viColl = new ViewInfoCollection();
viColl["A"] = new ViewInfo("A", typeof(int));
viColl["B"] = new ViewInfo("B", typeof(string));
}
[Test]
public void TestAdd()
{
ViewInfo vi = new ViewInfo("C", typeof(bool));
viColl.Add(vi);
Assert.AreSame(vi, viColl["C"]);
}
[Test]
public void TestCount()
{
Assert.AreEqual(2, viColl.Count);
}
[Test]
public void TestAddColl()
{
ViewInfoCollection viColl2 = new ViewInfoCollection();
viColl2["D"] = new ViewInfo("D", typeof(decimal));
viColl2["E"] = new ViewInfo("E", typeof(long));
viColl.Add(viColl2);
Assert.AreEqual(4, viColl.Count);
Assert.AreSame(viColl2["D"], viColl["D"]);
Assert.AreSame(viColl2["E"], viColl["E"]);
}
[Test]
public void TestEnumerate()
{
bool containsA = false, containsB = false;
int count = 0;
foreach (ViewInfo vi in viColl)
{
if (vi == viColl["A"])
containsA = true;
else if (vi == viColl["B"])
containsB = true;
count++;
}
Assert.AreEqual(2, count);
Assert.IsTrue(containsA && containsB);
}
}
}
|
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.