07.11.2014 Views

Enterprise Library Test Guide - Willy .Net

Enterprise Library Test Guide - Willy .Net

Enterprise Library Test Guide - Willy .Net

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

18<br />

<strong>Enterprise</strong> <strong>Library</strong> <strong>Test</strong> <strong>Guide</strong><br />

The Car class uses this data. The automated tests verify that the core creates a Car<br />

object as a singleton object and a CommonItem object as a named instance. The<br />

Car class provides methods to increase and decrease the car’s speed and to change<br />

the wheel. The following code shows the two configuration file sections.<br />

<br />

<br />

<br />

…<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Table 5 lists the Visual Studio Team System tests that were used with the <strong>Enterprise</strong><br />

<strong>Library</strong> Core.<br />

Table 5: Visual Studio Team System <strong>Test</strong>s for the Core<br />

<strong>Test</strong> case Result Automated test<br />

Verify that the core<br />

can use data from<br />

the configuration<br />

source to create<br />

both a named<br />

instance and a<br />

default instance<br />

of a CommonItem<br />

object.<br />

Passed<br />

The following test creates a named instance of a CommonItem<br />

object.<br />

//This is the named instance test<br />

[<strong>Test</strong>Method]<br />

public void CreateNamedTypeObject()<br />

{<br />

ItemProviderFactory factory = new ItemProviderFactory();<br />

IItem item = factory.Create("MicrosoftXP");<br />

Assert.IsTrue(item.CalculateTotal() == 0);<br />

}<br />

The following test creates a default instance of a CommonItem<br />

object.<br />

// This is the default instance test<br />

[<strong>Test</strong>Method]<br />

public void CreateDefaultObject()<br />

{<br />

ItemProviderFactory factory = new ItemProviderFactory();<br />

IItem item = factory.CreateDefault();<br />

Assert.IsTrue(item.CalculateTotal() == 0);<br />

}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!