Microsoft Fakes and Shims

This is pretty cool that you can use this technique to test around .net framework items like this

http://msdn.microsoft.com/en-us/library/hh549175.aspx

// Code under test:
public int GetTheCurrentYear()
{
return DateTime.Now.Year;
}
//
//--------------------
//
[TestClass]
public class TestClass1
{
[TestMethod]
public void TestCurrentYear()
{
int fixedYear = 2000;

// Shims can be used only in a ShimsContext:
using (ShimsContext.Create())
{
// Arrange:
// Shim DateTime.Now to return a fixed date:
System.Fakes.ShimDateTime.NowGet =
() =>
{ return new DateTime(fixedYear, 1, 1); };

// Instantiate the component under test:
var componentUnderTest = new MyComponent();

// Act:
int year = componentUnderTest.GetTheCurrentYear();

// Assert:
// This will always be true if the component is working:
Assert.AreEqual(fixedYear, year);
}
}
}

Advertisements

Problems serving .svc in IIS 8 on Windows 8

I recently had some problems running telerik Sitefinity on my dev machine.  When I clicked on the Pages menu, it would give me a popup telling me that IIS 8.0 returned a 404.

All the help online talked about reregistering the WCF stuff using Servicemodelreg.exe, but doing that seemed to screw stuff up even more.  Others also talked about using aspnet_regiis, but that doesn’t work in Windows 8.

Finally, I found this post that dealt with the exact issue.  Adding the WCF Services under Turn Windows features on or off worked perfectly.

Thanks to http://proq.blogspot.com/

Outlook 2013 keeps clearing my IMAP email

For about the 10th time, Outlook 2013 has again “cleared” out my local IMAP / Google Apps email.  It will now spend the next hour re-downloading all the items that are in my inbox and other folders.  I like nothing about Outlook 2013 so I just need to find some time to uninstall and reinstall 2010. 

Just thought I’d put this here in case someone else is having the same problem and is wondering if it’s happening to anyone else.