Welcome to Manicprogrammer Sign in | Join | Help

Dr. Frankenstein

I´m feeling like Dr. Frankenstein right now!

Finally HE LIVES!!! The WIQL query generator is ready and it passed the following (hard, come on!) unit test:

   1:  DateTime targetDate = DateTime.ParseExact(
   2:      DateTime.Now.AddDays(-1).ToString("dd/MM/yyyy"), 
   3:      "dd/MM/yyyy", null);
   4:  string targetUser = "Heynemann_cp";
   5:  FilterCollection fc =
   6:      (
   7:          Filter.Equal("Status", Status.Active) &
   8:          Filter.GreaterOrEqual("ChangedDate", targetDate) &
   9:          Filter.Equal("ChangedBy", targetUser)
  10:      ) | 
  11:      (
  12:          Filter.Equal("Status", Status.Closed)
  13:          & Filter.Lesser("ChangedDate", targetDate)
  14:      );
  15:  IList<Feature> feats = QueryManager.GetWorkItems<Feature>(fc);

 This test worked! If you take a look in the code above, the expected (and achieved) behavior would be for the Mapper to get all the Features that:

1) Are active (status), have been changed since current date -1 day, and changed by "Heynemann_cp" (yours truly).

OR

2) Are closed (status) and have been changed until current date -1 day.

This is a pretty hard task to achieve and I´m really proud of it (hence the Frankenstein part of the post). The greatest part of this is that it gives the Mapper a great functionality in that you can write almost any query you´d like in a type-safe manner and by the use of parenthesis you can really control what your conditions will be.

Well, almost type-safe, since the property names are still strings, but I´m working on it and I have already found a way to circumvent this, but one that I´m not too fond of.

If anyone knows of a way to use property names of a class in a type-safe way, please, and that´s a BIG PLEASE, let me know.

My next step in the project is implementing the TFS default agile template workitem types Object Model.

Published Wednesday, September 27, 2006 1:40 AM by heynemann

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments


Enter the text you see in the image:

Leave a Comment

(required) 
required 
(required)