More on using the VS11 fake library to fake out SharePoint

I recently posted on how you could use the new fakes tools in VS11 to fake out SharePoint for testing purposes. I received comments on how I could make my Shim logic easier to read so though I would revisit the post. This led me down a bit of a complex trail, and to Pete Provost for pointing the way out! When I did the previous post I had used SP2007, this was because I was comparing using Microsoft Fakes with a similar sample I had written ages ago for Typemock Isolator. There was no real plan to this choice, it was just what had to hand at the time. This time I decided to use SP2010, this was the process used that actually worked (more on my mistakes later) … ...

May 5, 2012 · 4 min · Richard Fennell

Thoughts on my Channel9 post

After hearing my TEE video on Channel9 mentioned on Radio TFS I thought I should watch it through, I had only found time to do a quick look previously. This is all part of my on-going self review process, a form of self torture. It seems the issues I mentioned last time are still there, I still have too many err’s. The thing that stood out the most was I looked like a very shifty newsreader. My movement behind the table and losing eye contact with the camera were too noticeable to me. ...

May 5, 2012 · 1 min · Richard Fennell

Thoughts on the new Skydrive

I have swapped to the new version of Microsoft Skydrive, replacing my old Mesh setup. It is a nice slick experience, allowing easy viewing of files on Skydrive from Windows and WP7. However, I do have couple of issues I used Mesh to sync photos from my Window 7 Media Center up to cloud storage as a backup, don’t want to loose all the family photos due to a disk failure. This was simple with Mesh, just set up a sync. This is not so easy with the new Skydrive, which appears only as a folder in your user area. The only solution I can spot is to copy my photos into this folder e.g. xcopy d:photos c:usersrichardskydrivephotos. Once the copy is done this will be synced up to the cloud. With mesh if I added a file to my PC it sync’d without me doing anything, now I need to remember the xcopy (or whatever sync copy tool I am using), or have the copy being run on a regular basis via a timer. Letting Skydrive start automatically on a laptop Windows PC is dangerous. I was on site today using my Mifi and in about 10 minutes used a whole days credit. So I would recommend changing your tool tray setting to make sure you can see the Skydrive icon all the time, so you have a chance see when it is syncing and can stop it when on a connection that cost you money. ...

April 26, 2012 · 2 min · Richard Fennell

My video on using Team Explorer Everywhere is published on Channel9

I recently recorded a video on using Visual Studio Team Explorer Everywhere, this has today been published in the UK Techdays section of Channel 9. Hope you find it useful.

April 24, 2012 · 1 min · Richard Fennell

Back from holiday to find my DDD Southwest session has been accepted

Got back from holiday today to find my DDDSW (26th May) session on unit testing in Visual Studio 11 has been accepted. I see the event is already full, but hope to see some of you there

April 16, 2012 · 1 min · Richard Fennell

Fix for problem faking two SPLists in a single unit test with Typemock Isolator has been released

A blogged a while ago about a problem faking multiple SPList with Typemock Isolator in a single test. With the release of Typemock Isolator 7.0.4.0 you no longer have to use the workaround I documented. You can now use the code if the originally planned, and it works as expected 1: public partial class TestPage : System.Web.UI.Page 2: { 3: public TestPage() 4: { 5: var fakeWeb = Isolate.Fake.Instance<SPWeb>(); 7: Isolate.WhenCalled(() => SPControl.GetContextWeb(null)).WillReturn(fakeWeb); 8: 9: // return value for 1st call 10: Isolate.WhenCalled(() => fakeWeb.Lists\["Centre Locations"\].Items).WillReturnCollectionValuesOf(CreateCentreList()); 11: // return value for all other calls 12: Isolate.WhenCalled(() => fakeWeb.Lists\["Map Zoom Areas"\].Items).WillReturnCollectionValuesOf(CreateZoomAreaList()); 13: } 14: 15: private static List<SPListItem> CreateZoomAreaList() 16: { 17: var fakeZoomAreas = new List<SPListItem>(); 18: fakeZoomAreas.Add(CreateZoomAreaSPListItem("London", 51.49275, -0.137722222, 2, 14)); 19: return fakeZoomAreas; 20: } 21: 22: private static List<SPListItem> CreateCentreList() 23: { 24: var fakeSites = new List<SPListItem>(); 25: fakeSites.Add(CreateCentreSPListItem("Aberdeen ", "1 The Road, Aberdeen ", "Aberdeen@test.com", "www.Aberdeen.test.com", "1111", "2222", 57.13994444, -2.113333333)); 26: fakeSites.Add(CreateCentreSPListItem("Altrincham ", "1 The Road, Altrincham ", "Altrincham@test.com", "www.Altrincham.test.com", "3333", "4444", 53.38977778, -2.349916667)); 27: return fakeSites; 28: } 29: 30: private static SPListItem CreateCentreSPListItem(string title, string address, string email, string url, string telephone, string fax, double lat, double lng) 31: { 32: var fakeItem = Isolate.Fake.Instance<SPListItem>(); 33: Isolate.WhenCalled(() => fakeItem\["Title"\]).WillReturn(title); 34: Isolate.WhenCalled(() => fakeItem\["Address"\]).WillReturn(address); 35: Isolate.WhenCalled(() => fakeItem\["Email Address"\]).WillReturn(email); 36: Isolate.WhenCalled(() => fakeItem\["Site URL"\]).WillReturn(url); 37: Isolate.WhenCalled(() => fakeItem\["Telephone"\]).WillReturn(telephone); 38: Isolate.WhenCalled(() => fakeItem\["Fax"\]).WillReturn(fax); 39: Isolate.WhenCalled(() => fakeItem\["Latitude"\]).WillReturn(lat.ToString()); 40: Isolate.WhenCalled(() => fakeItem\["Longitude"\]).WillReturn(lng.ToString()); 41: return fakeItem; 42: } 43: 44: private static SPListItem CreateZoomAreaSPListItem(string areaName, double lat, double lng, double radius, int zoom) 45: { 46: var fakeItem = Isolate.Fake.Instance<SPListItem>(); 47: Isolate.WhenCalled(() => fakeItem\["Title"\]).WillReturn(areaName); 48: Isolate.WhenCalled(() => fakeItem\["Latitude"\]).WillReturn(lat.ToString()); 49: Isolate.WhenCalled(() => fakeItem\["Longitude"\]).WillReturn(lng.ToString()); 50: Isolate.WhenCalled(() => fakeItem\["Radius"\]).WillReturn(radius.ToString()); 51: Isolate.WhenCalled(() => fakeItem\["Zoom"\]).WillReturn(zoom.ToString()); 52: return fakeItem; 53: } 54: 55: } A check of the returned values shows ...

April 2, 2012 · 2 min · Richard Fennell

More community TFS build extensions documentation

As part of the on-going effort in documentation I have recently published more documentation for the TFS build extension project activities AssemblyInfo CodeMetric (updated) and CodeMetricHistory File Twitter

March 29, 2012 · 1 min · Richard Fennell

Unit testing in VS11Beta and getting your tests to run on the new TFSPreview build service

One of my favourite new features in VS11 is that the unit testing is pluggable. You don’t have to use MSTest, you can use any test framework that an adaptor is available for (at the release of the beta this meant the list of framworks on Peter Provost’s blog, but I am sure this will grow). So what does this mean and how do you use it? Add some tests First it is worth noting that you no longer need to use a test project to contain your MSTest, you can if you want, but you don’t need to. So you can ...

March 27, 2012 · 4 min · Richard Fennell

How I try to keep up to date

I have just added a page to the blog that lists some of the podcasts I try to listen to, in an attempt to keep up to date.

March 26, 2012 · 1 min · Richard Fennell

Keeping up to date

Ours is a fast moving industry and as times goes on I find the need to specialise more and more. However, I believe there is a great value in at least having a passing knowledge of as much of our field as possible, IT pros can learn from developers and .NET team from Java and of course the other way around. I find the best way to try to keep abreast of new ideas is to listen to podcasts; I personally find it hard read enough blogs, but I can find time to listen to a podcast whist travelling or working around the house. Here is a list of a few I find give me at least a feel for what is going on, I still feel that they are a bit Microsoft focused, so interested to hear any other suggestions ...

March 26, 2012 · 2 min · Richard Fennell