Wednesday, February 25, 2015

Daily Lesson 1 of 2 : Test Project in .NET

Make sure that your test project has the same .NET framework setting as the code it's testing.

I was working through an issue with emails not being sent via a windows service running on a loop with a heartbeat to process emails from a DB table queue. Design issues aside, there was an error being logged about the set operation of the .NET MailMessage Subject property.

In order to debug the issue, I whipped up a quick test project in Visual Studio with a single test class with a single method. The method set the Subject property in a for each loop with a try-catch-throw wrapped around the set call. The throw generated a new exception with the current subject from the loop so I know which one was causing the issue.

Next, I grabbed all the queued subjects with a SQL statement which appended " to the front and ", to the back of all subjects in the queue table. I ran the query, copied the results, pasted into the test inside the array initializer. Ran the test and milliseconds later it passed. WTF!?

I examined the MailMessage class from the original and noticed it was from .NET 2 and the one in my test proj was from .net 4. Duh, use the same version of .NET in the test proj as the source code version. So I changed the version in the test project to 3.5 and now it was in synch.

Ran the test again and BAM passed again...seriously!!? Lesson Learned 2 of 2 tells why.


  1. Replies
    1. The effectiveness of IEEE Project Domains depends very much on the situation in which they are applied. In order to further improve IEEE Final Year Project Domains practices we need to explicitly describe and utilise our knowledge about software domains of software engineering Final Year Project Domains for CSE technologies. This paper suggests a modelling formalism for supporting systematic reuse of software engineering technologies during planning of software projects and improvement programmes in Final Year Projects for CSE.

      Software management seeks for decision support to identify technologies like JavaScript that meet best the goals and characteristics of a software project or improvement programme. JavaScript Training in Chennai Accessible experiences and repositories that effectively guide that technology selection are still lacking.

      Aim of technology domain analysis is to describe the class of context situations (e.g., kinds of JavaScript software projects) in which a software engineering technology JavaScript Training in Chennai can be applied successfully

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

  2. Nice! you are sharing such helpful and easy to understandable blog. i have no words for say i just say thanks because it is helpful for me.

    Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery