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);
}
}
}

Turn minified JS into readable JS

Another cool site.

http://jsbeautifier.org/

Sometimes when you are trying to figure out what’s going on in some minified javascript, it’s quite difficult to read.  Just copy and paste it into jsbeautifier and press Ctrl+Enter.

Here is the jquery source before (1 giant line):

image

and after (notice the scrollbar difference on the right):

image

Cool.

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.

Typescript

I came across Typescript today from Microsoft.  It’s a superset of Javascript, that allows you to write a bunch of Javascript-like code and have it compile into Javascript.  The main benefit here that I see is intellinsense and getting type checks at compile time.

Wouldn’t you love to write Javascript like this?

image

Nice intellisense!

Visual Studio picture