{"id":10904,"date":"2014-12-05T05:09:58","date_gmt":"2014-12-04T18:09:58","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=10904"},"modified":"2014-12-05T05:09:58","modified_gmt":"2014-12-04T18:09:58","slug":"visual-studio-c-nunittest-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/visual-studio-c-nunittest-primer-tutorial\/","title":{"rendered":"Visual Studio C# NUnitTest Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Windows\/NUnit\/\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Visual Studio C# NUnitTest Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Windows\/NUnit\/HTLM5_Slideshow-91of.jpg\" title=\"Visual Studio C# NUnitTest Primer Tutorial\"   \/><\/a><p class=\"wp-caption-text\">Visual Studio C# NUnitTest Primer Tutorial<\/p><\/div>\n<p>The acronym <a target=_blank title='SDLC information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Systems_development_life_cycle'>SDLC<\/a> (Software Development Life Cycle) describes a lot of what the environment for a programmer consists of, but there are so many variations within the workplace of where the role of the <i>&#8220;programmer&#8221;<\/i> starts and stops.<\/p>\n<p>One of the most contentious divisions is about where the responsibility for <i>testing<\/i> code sits, and, a bit before that, what does <i>testing<\/i> mean for your code.  To me, <i>testing<\/i> can involve at least (in order of likelihood) some\/all of:<\/p>\n<ul>\n<li><a target=_blank title='Unit testing information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Unit_testing'>unit testing<\/a><\/li>\n<li>team testing<\/li>\n<li>component testing<\/i>\n<li>quality assurance testing<\/li>\n<li>user acceptance testing<\/li>\n<li>load testing<\/li>\n<li>disaster recovery testing<\/li>\n<\/ul>\n<p>As a programmer I feel very responsible for the <i>unit testing<\/i> component because &#8230; doh! &#8230; you want to do a good job.  Even here, though, it can be argued that you should work in teams where even <i>unit testing<\/i> has that second set of eyes applied to it &#8230; hence the <i>team testing<\/i> concept.   Definitely with the non <i>unit testing<\/i> testing types an independent eye can be good to offset the naturally optimistic ideas of most programmers.<\/p>\n<p>As a programmer I feel that <i>unit testing<\/i> is both the important thing a programmer can do, and sometimes the part of the SDLC that they spend the most time doing.<\/p>\n<p>There is no doubt that today&#8217;s C# console project code in Visual Studio (IDE) for a Windows desktop environment with an <i>Arithmetic<\/i> class involving simple mathematical methods lacks that real world scenario that you will be likely to want NUnit to be used on, but use it as a starting point to learn more.  Here is a good <a target=_blank title='NUnit link' href='http:\/\/www.nunit.org\/index.php?p=quickStart&#038;r=2.5'>link<\/a> to start further studies.   The main introductory concept to get your head around is the idea of an <a target=_blank title='NUnitTest Assertion' href='http:\/\/www.nunit.org\/index.php?p=assertions&#038;r=2.5'><i>Assert<\/i><\/a>ion.<\/p>\n<p><a target=_blank title='C# Socket Primer Tutorial' href='http:\/\/www.rjmprogramming.com.au\/Windows\/NUnit\/' title='Click picture'>Today<\/a> we show a Visual Studio (IDE) C# programming tool called <a target=_blank title='NUnitTest download' href='https:\/\/visualstudiogallery.msdn.microsoft.com\/b8a7a8fa-9f5a-4b9b-8e8b-8839a4364f26'>NUnitTest<\/a>, which is a downloadable Online Template written by <a target=_blank title='Ernest Poletaev' href='https:\/\/visualstudiogallery.msdn.microsoft.com\/site\/search?f[0].Type=User&#038;f[0].Value=Ernest%20Poletaev'>Ernest Polataev<\/a>.<\/p>\n<p>Here is some downloadable C# programming supervisory source code which you might want to rename to <a target=_blank title='Program.cs' href='http:\/\/www.rjmprogramming.com.au\/Windows\/NUnit\/Program.cs_GETME'>Program.cs<\/a><\/p>\n<p>Here is some downloadable C# programming <i>Arithmetic<\/i> class (being tested) source code which you might want to rename to <a target=_blank title='Arithmetic.cs.cs' href='http:\/\/www.rjmprogramming.com.au\/Windows\/NUnit\/Arithmetic.cs_GETME'>Arithmetic.cs<\/a><\/p>\n<p>Here is some downloadable C# programming testing class source code which you might want to rename to <a target=_blank title='TestFixture.cs' href='http:\/\/www.rjmprogramming.com.au\/Windows\/NUnit\/TestFixture.cs_GETME'>TestFixture.cs<\/a><\/p>\n<p>Maybe you&#8217;d like to continue on with the C# theme, and if so, you could read <a target=_blank href='#cspt' title='C# Socket Primer Tutorial'>C# Socket Primer Tutorial<\/a> as below.<\/p>\n<hr \/>\n<p id='cspt'>Previous tutorial of interest <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=4801' title='C# Socket Primer Tutorial'>C# Socket Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/CHash\/Socket\/CHash_socket_Primer.jpg\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"C# Socket Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/CHash\/Socket\/CHash_socket_Primer.jpg\" title=\"C# Socket Primer Tutorial\"   \/><\/a><p class=\"wp-caption-text\">C# Socket Primer Tutorial<\/p><\/div>\n<p>C# using Visual Studio on Windows is a great language to  <a target=_blank title='click picture' href='http:\/\/www.rjmprogramming.com.au\/VB.NET\/VBdotNet-Windows-Form-Desktop-Application-VisualStudio.png'>learn<\/a>.   If you like C# you may eventually like VB.Net, and vice versa.   It has sophisticated data structures, can be Object Oriented and makes great Windows desktop applications or can be the code behind an ASP.Net website or web application.     <\/p>\n<p>C# and VB.Net have Visual Studio support for functionality to do with networking and the use of sockets, as described below at Wikipedia.<\/p>\n<blockquote><p>A network socket is an endpoint of an inter-process communication flow across a computer network. Today, most communication between computers is based on the Internet Protocol; therefore most network sockets are Internet sockets.<\/p>\n<p>A socket API is an application programming interface (API), usually provided by the operating system, that allows application programs to control and use network sockets. Internet socket APIs are usually based on the Berkeley sockets standard.<\/p>\n<p>A socket address is the combination of an IP address and a port number, much like one end of a telephone connection is the combination of a phone number and a particular extension. Based on this address, internet sockets deliver incoming data packets to the appropriate application process or thread.<\/p><\/blockquote>\n<p>Hope you enjoy the <a target=_blank title='C# Socket Primer Tutorial' href='http:\/\/www.rjmprogramming.com.au\/CHash\/Socket\/CHash_socket_Primer.jpg'>tutorial<\/a> in which we create a socket for communications using the http protocol to a host of your choosing &#8230; we chose google.com &#8230; you will need to have your internet connection working and check that the firewall settings allow port 80 to communicate with a socket.   In this tutorial we establish a socket and make a request and receive a response.   In practice you would continue on with more sophistication.<\/p>\n<p>Here is some downloadable C# programming source code which you might want to rename to <a target=_blank title='Program.cs' href='http:\/\/www.rjmprogramming.com.au\/CHash\/Socket\/Program.cs_GETME'>Program.cs<\/a><\/p>\n<p>The Socket Class <a target=_blank title='Socket tutorial from Microsoft' href='http:\/\/msdn.microsoft.com\/en-us\/library\/system.net.sockets.socket.aspx'>tutorial<\/a> was used and amended only slightly for this tutorial, so please start here on the path to further examination of this very interesting and fundamental area of network programming.<\/a><\/p>\n<p>Link to Socket information from <a target=_blank title='socket information from Wikipedia' href='http:\/\/en.wikipedia.org\/wiki\/Network_socket'>Wikipedia<\/a>, from where the quote above came.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d4801' onclick='var dv=document.getElementById(\"d4801\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?s=C%23\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d4801' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr \/>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d10904' onclick='var dv=document.getElementById(\"d10904\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?cat=46\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d10904' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The acronym SDLC (Software Development Life Cycle) describes a lot of what the environment for a programmer consists of, but there are so many variations within the workplace of where the role of the &#8220;programmer&#8221; starts and stops. One of &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/visual-studio-c-nunittest-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,28,33,37,39],"tags":[176,234,319,549,585,997,1109,1253,1319,1337,1383,1435],"class_list":["post-10904","post","type-post","status-publish","format-standard","hentry","category-elearning","category-oop","category-software","category-tutorials","category-visual-studio","tag-c","tag-command-line","tag-desktop","tag-gui","tag-ide","tag-programming","tag-sdlc","tag-testing","tag-tutorial","tag-unit-testing","tag-visual-studio","tag-windows"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/10904"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=10904"}],"version-history":[{"count":0,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/10904\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=10904"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=10904"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=10904"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}