<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>GTTools.com &#187; Development</title>
	<atom:link href="http://gttools.com/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://gttools.com</link>
	<description></description>
	<lastBuildDate>Wed, 02 Mar 2011 16:52:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How to iterate a C# dictionary</title>
		<link>http://gttools.com/2009/01/how-to-iterate-a-dicitonary/</link>
		<comments>http://gttools.com/2009/01/how-to-iterate-a-dicitonary/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 23:07:23 +0000</pubDate>
		<dc:creator>GAT</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[collections]]></category>
		<category><![CDATA[howto]]></category>

		<guid isPermaLink="false">http://gttools.com/?p=65</guid>
		<description><![CDATA[The following snippet shows an easy way to iterate a C# dictionary: Dictionary&#60;int, string&#62; dictionary = new Dictionary&#60;int, string&#62;(); dictionary.Add(1, &#34;Cat&#34;); dictionary.Add(2, &#34;Dog&#34;); dictionary.Add(3, &#34;Horse&#34;); foreach (var item in dictionary) { // do stuff with item Console.WriteLine(string.Format(&#34;{0} - {1}&#34;, item.Key, &#8230; <a href="http://gttools.com/2009/01/how-to-iterate-a-dicitonary/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The following snippet shows an easy way to iterate a C# dictionary:</p>
<pre class="brush: c#; ">

            Dictionary&lt;int, string&gt; dictionary = new Dictionary&lt;int, string&gt;();

            dictionary.Add(1, &quot;Cat&quot;);
            dictionary.Add(2, &quot;Dog&quot;);
            dictionary.Add(3, &quot;Horse&quot;);

            foreach (var item in dictionary)
            {
                // do stuff with item
                Console.WriteLine(string.Format(&quot;{0} - {1}&quot;, item.Key, item.Value));
            }

            // Result:
            // 1 - Cat
            // 2 - Dog
            // 3 - Horse
</pre>
]]></content:encoded>
			<wfw:commentRss>http://gttools.com/2009/01/how-to-iterate-a-dicitonary/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging gac assemblies</title>
		<link>http://gttools.com/2008/03/debugging-gac-assemblies/</link>
		<comments>http://gttools.com/2008/03/debugging-gac-assemblies/#comments</comments>
		<pubDate>Sat, 15 Mar 2008 20:50:53 +0000</pubDate>
		<dc:creator>GAT</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[assembly]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[gac]]></category>
		<category><![CDATA[howto]]></category>

		<guid isPermaLink="false">http://gttools.com/?p=13</guid>
		<description><![CDATA[Every now and then somebody says to me: I just added my assembly to the gac and now I can&#8217;t debug my code anymore The fact is that debugging gac assemblies is quite easy when you know how to do &#8230; <a href="http://gttools.com/2008/03/debugging-gac-assemblies/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Every now and then somebody says to me:</p>
<blockquote><p>I just added my assembly to the gac and now I can&#8217;t debug my code anymore <img src='http://gttools.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p></blockquote>
<p>The fact is that debugging gac assemblies is quite easy when you know how to do it.</p>
<p>The problem with debugging gac assemblies is that you can&#8217;t add the pdb file to the gac. What you need to do is to find the actual folder where your assembly is stored and copy your pdb file into this location.</p>
<p>To find this folder you need to run the following command from start-&gt;run:</p>
<p><strong>C:\WINDOWS\Assembly\GAC_MSIL</strong></p>
<p>Navigate to your assembly by drilling down in the folders. Copy your pdb file to the same folder as your dll.</p>
<p>You should now be able to debug your assembly by attaching to the running process.</p>
<p>( If you are not building your assembly as a MSIL assembly you will find it under:  C:\WINDOWS\Assembly\GAC or C:\WINDOWS\Assembly\GAC_32 )</p>
]]></content:encoded>
			<wfw:commentRss>http://gttools.com/2008/03/debugging-gac-assemblies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use random data in WebTest</title>
		<link>http://gttools.com/2008/01/use-random-data-in-webtest/</link>
		<comments>http://gttools.com/2008/01/use-random-data-in-webtest/#comments</comments>
		<pubDate>Tue, 01 Jan 2008 10:39:56 +0000</pubDate>
		<dc:creator>GAT</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Test Automation]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[WebTest]]></category>

		<guid isPermaLink="false">http://gttools.com/?p=14</guid>
		<description><![CDATA[Usually my WebTests are coded WebTests, but sometimes the plain WebTest can do the job a lot faster. My biggest problem working with plain WebTests, is that all the input to my forms are the recorded values. In some of &#8230; <a href="http://gttools.com/2008/01/use-random-data-in-webtest/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Usually my WebTests are coded WebTests, but sometimes the plain WebTest can do the job a lot faster.</p>
<p>My biggest problem working with plain WebTests, is that all the input to my forms are the recorded values.  In some of the text fields I need value variations every run.</p>
<p>To solve this problem I created a WebTest plugin. This plugin creates a couple of Context variables on the <span style="color: black">PreWebTest event</span>. These variables can easily be used in the WebTest using the: {{<span style="font-style: italic">VAR_NAME</span>}} syntax.</p>
<ul>
<li>{{RANDOM}}               &#8211; Gives you a random string of 5 characters</li>
<li>{{RANDOMNUM}}     &#8211; Gives you a string of 4 random numeric characters</li>
<li>{{TIME_STAMP}}      &#8211; Gives you a time stamp as a string</li>
</ul>
<p>Just copy the code below into a C# Class Library project and compile. You can now connect your WebTest to this WebTestPlugin.</p>
<pre><span style="color: blue" lang="EN-US">using </span><span style="color: black" lang="EN-US">System</span><span style="color: blue" lang="EN-US">;
using </span><span style="color: black" lang="EN-US">System.Collections.Generic</span><span style="color: blue" lang="EN-US">;
using </span><span style="color: black" lang="EN-US">System.Text</span><span style="color: blue" lang="EN-US">;
using </span><span style="color: black" lang="EN-US">Microsoft.VisualStudio.TestTools.WebTesting</span><span style="color: blue" lang="EN-US">;</span>

namespace <span style="color: black" lang="EN-US">MyPlugin
{
</span><span style="color: blue" lang="EN-US">    public class </span><span style="color: black" lang="EN-US">RandomGenerator : WebTestPlugin
    {
</span><span style="color: blue" lang="EN-US">        public override void </span><span style="color: black" lang="EN-US">PreWebTest(</span><span style="color: blue" lang="EN-US">object </span><span style="color: black" lang="EN-US">sender, PreWebTestEventArgs e)
        {</span>
<span style="color: black" lang="EN-US">            Random ran </span><span style="color: blue" lang="EN-US">= new </span><span style="color: black" lang="EN-US">Random()</span><span style="color: blue" lang="EN-US">;
</span><span style="color: black" lang="EN-US">            e.WebTest.Context[</span><span style="color: gray" lang="EN-US">"RANDOM"</span><span style="color: black" lang="EN-US">] </span><span style="color: blue" lang="EN-US">= </span><span style="color: black" lang="EN-US">GetRandomString(</span><span style="color: maroon" lang="EN-US">5</span><span style="color: black" lang="EN-US">)</span><span style="color: blue" lang="EN-US">;
</span><span style="color: black" lang="EN-US">            e.WebTest.Context[</span><span style="color: gray" lang="EN-US">"RANDOMNUM"</span><span style="color: black" lang="EN-US">] </span><span style="color: blue" lang="EN-US">= </span><span style="color: black" lang="EN-US">GetRandomNumberString(</span><span style="color: maroon" lang="EN-US">4</span><span style="color: black" lang="EN-US">)</span><span style="color: blue" lang="EN-US">;
</span><span style="color: black" lang="EN-US">            e.WebTest.Context[</span><span style="color: gray" lang="EN-US">"TIME_STAMP"</span><span style="color: black" lang="EN-US">] </span><span style="color: blue" lang="EN-US">= </span><span style="color: black" lang="EN-US">GetTimeStamp()</span><span style="color: blue" lang="EN-US">;
</span><span style="color: black" lang="EN-US">        }</span>

<span style="color: blue" lang="EN-US">        public override void </span><span style="color: black" lang="EN-US">PostWebTest(</span><span style="color: blue" lang="EN-US">object </span><span style="color: black" lang="EN-US">sender, PostWebTestEventArgs e)
        {
        }

</span><span style="color: darkgreen" lang="EN-US">        /// &lt;summary&gt;
        /// Creates a random uppercase string with the letters A-Z
        /// &lt;/summary&gt;
        /// &lt;param name="length"&gt;Length of the string to generate&lt;/param&gt;
        /// &lt;returns&gt;A random generated string of upper case characters&lt;/returns&gt;

</span><span style="color: blue" lang="EN-US">        protected string </span><span style="color: black" lang="EN-US">GetRandomString(</span><span style="color: blue" lang="EN-US">int </span><span style="color: black" lang="EN-US">length)
        {
            Random ran </span><span style="color: blue" lang="EN-US">= new </span><span style="color: black" lang="EN-US">Random()</span><span style="color: blue" lang="EN-US">;
            char</span><span style="color: black" lang="EN-US">[] chArray </span><span style="color: blue" lang="EN-US">= new char</span><span style="color: black" lang="EN-US">[length]</span><span style="color: blue" lang="EN-US">;</span>

            for <span style="color: black" lang="EN-US">(</span><span style="color: blue" lang="EN-US">int </span><span style="color: black" lang="EN-US">i </span><span style="color: blue" lang="EN-US">= </span><span style="color: maroon" lang="EN-US">0</span><span style="color: blue" lang="EN-US">; </span><span style="color: black" lang="EN-US">i &lt; length</span><span style="color: blue" lang="EN-US">; </span><span style="color: black" lang="EN-US">i++)
            {
                chArray[i] </span><span style="color: blue" lang="EN-US">= </span><span style="color: black" lang="EN-US">(</span><span style="color: blue" lang="EN-US">char</span><span style="color: black" lang="EN-US">)ran.Next(</span><span style="color: maroon" lang="EN-US">65</span><span style="color: black" lang="EN-US">, </span><span style="color: maroon" lang="EN-US">90</span><span style="color: black" lang="EN-US">)</span><span style="color: blue" lang="EN-US">;
</span><span style="color: black" lang="EN-US">            }</span>

<span style="color: blue" lang="EN-US">            return new string</span><span style="color: black" lang="EN-US">(chArray)</span><span style="color: blue" lang="EN-US">;
</span><span style="color: black" lang="EN-US">        }

</span><span style="color: darkgreen" lang="EN-US">        /// &lt;summary&gt;
        /// Creates a random string with numeric characters
        /// &lt;/summary&gt;
        /// &lt;param name="length"&gt;Length of the string to generate&lt;/param&gt;
        /// &lt;returns&gt;A random generated string of numeric characters&lt;/returns&gt;

</span><span style="color: blue" lang="EN-US">        protected string </span><span style="color: black" lang="EN-US">GetRandomNumberString(</span><span style="color: blue" lang="EN-US">int </span><span style="color: black" lang="EN-US">length)
        {
            Random ran </span><span style="color: blue" lang="EN-US">= new </span><span style="color: black" lang="EN-US">Random()</span><span style="color: blue" lang="EN-US">;
            char</span><span style="color: black" lang="EN-US">[] chArray </span><span style="color: blue" lang="EN-US">= new char</span><span style="color: black" lang="EN-US">[length]</span><span style="color: blue" lang="EN-US">;</span>

            for <span style="color: black" lang="EN-US">(</span><span style="color: blue" lang="EN-US">int </span><span style="color: black" lang="EN-US">i </span><span style="color: blue" lang="EN-US">= </span><span style="color: maroon" lang="EN-US">0</span><span style="color: blue" lang="EN-US">; </span><span style="color: black" lang="EN-US">i &lt; length</span><span style="color: blue" lang="EN-US">; </span><span style="color: black" lang="EN-US">i++)
            {
                chArray[i] </span><span style="color: blue" lang="EN-US">= </span><span style="color: black" lang="EN-US">(</span><span style="color: blue" lang="EN-US">char</span><span style="color: black" lang="EN-US">)ran.Next(</span><span style="color: maroon" lang="EN-US">48</span><span style="color: black" lang="EN-US">, </span><span style="color: maroon" lang="EN-US">57</span><span style="color: black" lang="EN-US">)</span><span style="color: blue" lang="EN-US">;</span>
<span style="color: black" lang="EN-US">            }

</span><span style="color: blue" lang="EN-US">            return new string</span><span style="color: black" lang="EN-US">(chArray)</span><span style="color: blue" lang="EN-US">;
</span><span style="color: black" lang="EN-US">        }</span>

<span style="color: darkgreen" lang="EN-US">        /// &lt;summary&gt;
        /// Creates a timestamp
        /// &lt;/summary&gt;
        /// &lt;returns&gt;The timestamp as a string&lt;/returns&gt;

</span><span style="color: blue" lang="EN-US">        protected </span><span style="color: black" lang="EN-US">String GetTimeStamp()
        {
            DateTime dt </span><span style="color: blue" lang="EN-US">= </span><span style="color: black" lang="EN-US">DateTime.Now</span><span style="color: blue" lang="EN-US">;
            return </span><span style="color: black" lang="EN-US">dt.ToShortDateString() + </span><span style="color: gray" lang="EN-US">" " </span><span style="color: black" lang="EN-US">+ dt.ToLongTimeString() + </span><span style="color: gray" lang="EN-US">":" </span><span style="color: black" lang="EN-US">+ dt.Millisecond</span><span style="color: blue" lang="EN-US">;</span>
<span style="color: black" lang="EN-US">        }</span>
    }
}</pre>
<p><span style="color: black;"><br />
</span><span style="color: #808080; font-family: tahoma; font-size: 8px">Colorized by: <a style="color: #808080" href="http://www.carlosag.net/Tools/CodeColorizer/">CarlosAg.CodeColorizer</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://gttools.com/2008/01/use-random-data-in-webtest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

