Testing code snippets for Visual Studio
October 30th, 2009If you create many test classes and test methods you probably repeat some code many times.
Here are some code snippets that I use every day at work, feel free to modify them if you want.
If you create many test classes and test methods you probably repeat some code many times.
Here are some code snippets that I use every day at work, feel free to modify them if you want.
We create many enumerations in our programs. But sometimes we can make a mistake that drives somebody else mad.
Let's suppose that the first programmer created an enum like this:
It does not look bad at the first look, yet another enum.
Another programmer created a list:
Then he would like to find there a first mood type which is a part of "good mood" group and pass the result to another layer of an application. He wrote the code:
Now he realized that it cannot work because Find method of a List(T) class returns default(T) when a list does not contain desired item. In this case he would get Mood.Awesome because it is the default value of the enum. I do not need to add that the Mood.Awesome is not even the part of the list.
We can solve this problem by several different approaches.
The question to discuss - which programmer made a mistake? The first one who created "unfortunate" enum or the second one who used wrong structure / wrong searching method?
I am writing this post on behalf my friend
He does not write anything by himself but many of his thoughts are very accurate and meaningful - I decided to share it with you.
So if you are intrested on Test Driven Development, go on...
Read the rest of this entry »
I am writing this post for myself because I am often confused when analysing a code with ref's used on objects
If you're not interested in - don't read.
I added a new section to this blog called "3D Effects" - you can download there some DX / OGL effects which I coded in my free time.