(+N) Consulting Inc.

Consulting | Software Solutions | Training

Code Camp coming up

It's that time of year again - Code Camp is next week, hosted at Cal State Fullerton. Many good presenters, many good sessions. Show up for one day both two, it's free to attend! Check it out, come by

Pex Gotcha - watch your predicate expressions

Just came back from another great SoCal Code Camp. I had some valuable insights and discussions about TDD and the use of Pex. Thank you attendees! While developing the presentation for Pex, I ran into a situation where the Pex.Assume() did not seem to work at all: Consider the function public List<short> MakeList(short baseNum, short count) { List<short> result = new List<short>(count); for (short i = 1; i <= count; i++) { result.Add((short)(baseNum * i)); } return result; }   Pex correctly identifies a potential flaw where the multiplication (baseNum * i) would result in overflow. Adding a filter PexAssume.IsTrue(baseNum * count < short.MaxValue)... [More]