Unit Testing Events with Anonymous Delegates in .NET 2.0

Wednesday, 22 February 2006

How do you unit test your event code? You use Anonymous Delegates

Here's a sample unit test that I've created that makes use of this technique:

        [TestMethod()]
        public void UpdateTestTimesTest()
        {
            object expected = UniSA.UniSAnet.SmartMark.DataAccess.DataItemChangedEventArgs.ChangeType.Update;
            object actual = null;
 
            UniSA.UniSAnet.SmartMark.DataAccess.TestComponent.DataItemChanged += delegate(object sender, UniSA.UniSAnet.SmartMark.DataAccess.DataItemChangedEventArgs e)
            {
                actual = e.Change;
            };
 
            Test test = UniSA.UniSAnet.SmartMark.DataAccess.TestComponent.GetTest(UnitTestingTestId);
 
            test.MinutesAllowed += 1;
            UniSA.UniSAnet.SmartMark.DataAccess.TestComponent.UpdateTestTimes(test);
 
            Assert.AreEqual(expected, actual);
 
        }

Default content in ContentPlaceHolder is not replaced when it contains <%= %> tags

Wednesday, 15 February 2006

I think I've found a bug in ASP.NET Master Pages - if you try to include any <%= %> tags in a ContentPlaceHolder control on a Master Page, then it doesn't get overidden by the content in the Content control.

Using CSS when JavaScript is disabled

Wednesday, 15 February 2006

I've often worried about pages that use CSS to hide content, then allow JavaScript to dynamically show it again (eg. when you click on something), that if JavaScript was disabled, then there's no way to show the content.

Project Seven shows an example of how to use CSS and make sure content is viewable with or without JavaScript enabled.

Click on the example to see how it works.

January CTP build of Atlas

Friday, 10 February 2006

January CTP build of Atlas has been released. Nikhil describes the changes from the previous release.

TFS Data Warehouse not updating

Wednesday, 8 February 2006

I noticed today that the reports section of our intallation of TFS were not updating - they were still only showing 24th January. Here's the workaround.