Working further with the Fluent Test Data Builder I was working on yesterday has led me to refactor what I had, and the result is, I think, even nicer! I've added a new method SetValue, and changed the from getting the Member.Name to getting the PropertyInfo from the Member. The other significant change is that I'm now wrapping the SetLength and SetValue methods in try catch blocks so that I can
Showing posts with label C# 3. Show all posts
Showing posts with label C# 3. Show all posts
Monday, January 19, 2009
Refactored: Fluent Test Data Builders Using Generic Extension Methods and Lambda Expressions
Posted on 2:52 PM by Unknown
Saturday, January 17, 2009
Fluent Test Data Builders Using Generic Extension Methods and Lambda Expressions
Posted on 6:33 PM by Unknown
Whilst writing some extension methods this evening to make creating objects in unit tests simpler I found myself writing methods that looked sufficiently similar to each other that I felt the code lacked a little DRYness. The code being written has to output a data extract in a fixed field length formatted text file. As such the length of the formatted fields is very important, so I had created
Thursday, June 19, 2008
Resharper 4.0 and Lambda Expressions
Posted on 4:52 AM by Unknown
Now I'm fairly new to the wonderful world of Resharper, so barely a day goes by where I don't discover something new about it, or through it. But today I found a feature that just made me want to share about it straight away. Let me set the scene. I'm coding a Lambda expression for use as a predicate and when finished I notice the now familiar little light bulb. Hmmm I thought, now what could
Tuesday, June 3, 2008
Using TextFieldParser objects and the My library in C# code
Posted on 3:25 PM by Unknown
I read this article on InfoQ (a great site for information for those that don't know it) and saw that there might be some confusion about whether this useful class could be used in C# projects. The answer of course is yes. Just reference the Microsoft.VisualBasic dll in your project and away you go.The My library is a little different it does a whole bunch of different things, providing both new
Sunday, May 18, 2008
Extension Methods - My new best friend*
Posted on 9:28 AM by Unknown
No that doesn't mean that I'm going to be [ab]using extension methods everywhere - though I suspect that extension methods could become the new singleton. That said I think that I am really starting to get them. Here's an example. Last night I'm doing some coding and I want to get some objects that I have written to serialise nicely to Xml. Now I don't want to give them public constructors as
Subscribe to:
Posts (Atom)