|
|
|
Training
Coaching, Mentoring, Courses, Presentations
|
Writing
Books, Magazines, Whitepapers, Articles
|
|
Development
C, C++, .NET, Agile, ASP.NET, Real-Time, AJAX
|
Technology
Tablet PC, Windows Mobile, Virtual Earth, Windows Vista
|
Something to Think About
"No problem can sustain the assault of sustained thinking."
- Voltaire
Dr. Neil's NotesWindows Mobile Unit Tests setting the time As if you didn't know, I am a fan of TDD (Test Driven Development). I try to work in a TDD manner as much as possible. Unit testing for Windows Mobile applications has always been somewhat challenging. Visual Studio 2008 (professional and above) allows me to work in a TDD manner as I build software for the Windows Mobile platform. I have been working on some software that needs the time to be changed as part of the tests. This might not be as simple as you think, but it's not hard as long as you know to set the local time not the system time on the device.
private SYSTEMTIME SetDateTime(DateTime dateTime) { SYSTEMTIME st = new SYSTEMTIME(); st.year = (short)dateTime.Year; st.month = (short)dateTime.Month; st.day = (short)dateTime.Day; st.hour = (short)dateTime.Hour; st.minute = (short)dateTime.Minute; st.second = (short)dateTime.Second; st.milliseconds = (short)dateTime.Millisecond;
return st; }
public struct SYSTEMTIME { public short year; public short month; public short dayOfWeek; public short day; public short hour; public short minute; public short second; public short milliseconds; }
[DllImport("coredll.dll", SetLastError=true)] static extern bool SetLocalTime(ref SYSTEMTIME time);
[TestMethod()] public void HourIsOne() { DateTime savedDT = DateTime.Now; SYSTEMTIME sysTime = SetDateTime(savedDT); sysTime.hour = 1;
bool setSuccess = SetLocalTime(ref sysTime); Assert.IsTrue(setSuccess, "Failed to SetLocalTime"); Assert.AreEqual(1, DateTime.Now.Hour, "Hour should be 1 after setting it");
sysTime = SetDateTime(savedDT); SetLocalTime(ref sysTime); }
| Local Feedback Loops I had a wonderful beach side meeting and lunch with Andrew Coates yesterday and we talked through a number of ideas. Mostly about TechEd Australia as that is Andrew's focus right now. We brainstormed ideas around how to get people talking more at the event rather than make it a series of push sessions. I find I rarely attend a session at conferences any more as I can watch them all online afterwards. The real value of a conference is meeting people and talking to them. Creating feedback loops for thought processes. Sometimes just listening in to other people talking can be enlightening too. We brainstormed some ideas around having the first session after the keynote being a panel for each track. The panel would introduce the speakers on that track and start the conversation around the track topics. Andrew has blogged about it. I hear complaints about there not being enough content at TechEd and comparing TechEd Australia to TechEd USA, which does have a lot more content and a much higher attendance. I don't think this is a good argument. You are allowed to go to both! TechEd USA is an awesome event and worth going to. TechEd Australia is different, it is a local event, smaller in nature and allows the local community to engage with each other. I don't believe TechEd Australia should just be a mini version of TechEd USA. That is a waste of time, the world is a small place and Australians are mostly capable of getting on an airplane to fly to TechEd USA if they want to. TechEd Australia has an opportunity to do something different and better for the local community. I believe the same is true for all events that run locally in a region. I am hoping for lots of good conversations at TechEd Australia that have local relevance.
| New Windows Mobile Dev Blog Amit Chopra from the Windows Mobile developer tools team at Microsoft has set up a new Windows Mobile developer blog. He has kicked off with a post about the the great line up of sessions at TechEd in Orlando next month. I'll be doing a session on Windows Vista sync center and some chalk talks. I'm looking forward to catching up with the mobile developers there.
|
|
|
|
|