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.

<strong>Test</strong>ing for Performance and Scalability 187<br />

ID Scenario <strong>Test</strong> code<br />

2 Read This is the code to read an item from the cache.<br />

protected void ReadItem_Click(object sender, EventArgs e)<br />

{<br />

this.primitivesCache= CacheFactory.GetCacheManager(DropDownLis<br />

t3.SelectedItem.Value);<br />

byte[]b=<br />

(byte[])this.primitivesCache.<br />

GetData(TextBox1.Text);<br />

}<br />

3 Remove This is the code to remove an item from the cache.<br />

protected void RemovingItem_Click(object sender, EventArgs e)<br />

{<br />

this.primitivesCache= CacheFactory.GetCacheManager(DropDownLis<br />

t3.SelectedItem.Value);<br />

primitivesCache.Remove(TextBox1.Text);<br />

}<br />

7 Flush This is the code to flush the cache.<br />

protected void FlusghingItem_Click(object sender, EventArgs e)<br />

{<br />

this.primitivesCache= CacheFactory.GetCacheManager(DropDownLis<br />

t3.SelectedItem.Value);<br />

primitivesCache.Flush();<br />

}<br />

Table 4 lists the ASP.NET test code.<br />

Table 4: ASP.NET Framework <strong>Test</strong> Code<br />

ID Scenario <strong>Test</strong> code<br />

1 Add This is the code to add items to the cache.<br />

protected void ASPNETadditem_Click(object sender, EventArgs e)<br />

{<br />

byte[] CacheObject = new byte[int.Parse(TextBox2.Text)];<br />

Cache[TextBox1.Text] = CacheObject<br />

}<br />

2 Read This is the code to read items from the cache.<br />

protected void ASPNETreaditem_Click(object sender, EventArgs e)<br />

{<br />

byte[] CacheObject= Cache[TextBox1.Text];<br />

}<br />

Profiling the Workload<br />

The number of users increases over time. The number of users was 1, 10, 50, 150, and<br />

300. There was no think time. Table 5 lists the distribution of operations.

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

Saved successfully!

Ooh no, something went wrong!