Skip to main content

Posts

Showing posts from 2010

Bob the builder

I recently started a new project which is very focused on having good test coverage which is great goal to have.  However, looking through their tests I started to notice a lot of setup code which was very similar and looked a lot like the following: 1: [TestMethod] 2: public void WhenTheAddressRepositoryIsAskedToAPersistAddressesItShouldCorrectlyPersistThoseAddresses() 3: { 4: // Arrange 5: var addressesToPersist = new List<Address>(); 6:   7: var address = new Address 8: { 9: AddressLine1 = Guid.NewGuid().ToString(), 10: AddressLine2 = Guid.NewGuid().ToString(), 11: AddressLine3 = Guid.NewGuid().ToString(), 12: AddressLine4 = Guid.NewGuid().ToString(), 13:

Trouble using the AdvancedFilterSet with the “whenCreated” active directory property

Over the last couple of days on my current project I have been working with the new account management API found in .NET 3.5 for communicating with active directory. This API is a massive improvement over the features provided by the older directory services and really does make creating, deleting, updating and finding users a lot simpler (for more information checkout http://msdn.microsoft.com/en-us/library/bb299745%28v=VS.100%29.aspx ). As part of the work I needed to provide the ability to find users based on the date they were created so following the approach on MSDN (see http://msdn.microsoft.com/en-us/library/bb384372.aspx ) I extended the “AdvancedFilters” class and added my own method for setting a filter for a query using the active directory property “whenCreated”. I should say this property stores the date and time a user is created with AD. Now the code shown below is what I first came up with and it looks like it will do the job right? 1: public class SearchFilter