Speaking at Northwest Arkansas Code Camp 2009, and you can join remotely

At 3:30 today I’ll be speaking at the Northwest Arkansas Code Camp 2009 about Concurrency in .NET 4.0.  Not in NWA?  No worries.  These guys have all the rooms setup with LiveMeeting, and are going to be making the content available during the day. If you’d like to join, just enter the LiveMeeting associated with each room at the Code Camp, you can find the links to them here. Come, join in the fun, ask questions, and learn something today!

Solution Clone v1.1

A quick update to Solution Clone was posted today to handle some new file types created in the BizTalk Deployment Framework v5.0.  You can find it here.

Unit Testing in BizTalk – TestFile v2.0

Some time ago I made a post about using external file dependencies with NUnit. That post was about using a class called TestFile, which implemented IDisposable, to temporarily store files to disk, and then clean them up afterwards. While learning my way around the BizTalk unit testing capabilities in BizTalk 2009, I realized that this class could use some minor initial modifications to make life easier. To that end, I present to you that updated class. The most important new feature is the ability to support having it generate the file name as a temp file, and the ability to load resources from any Assembly in the AppDomain. public class TestFile : IDisposable { private bool _disposedValue = false; private string _resourceName; private string _fileName; public TestFile(string resourceName) : this(null, resourceName) { } public TestFile(string fileName, string resourceName) { if (fileName == null) { this.FileName = Path.GetTempFileName(); File.Delete(this.FileName); } else this.FileName = fileName; using (Stream s = LoadResourceFromAppDomain(resourceName)) using (StreamReader sr = new StreamReader(s)) using (StreamWriter sw = File.CreateText(this.FileName)) { sw.Write(sr.ReadToEnd()); sw.Flush(); } } private Stream LoadResourceFromAppDomain(string resourceName) { Assembly[] appDomainAssemblies = AppDomain.CurrentDomain.GetAssemblies(); Stream outStream = null; foreach (var lAssem in appDomainAssemblies) { outStream = lAssem.GetManifestResourceStream(resourceName); if (outStream != null) return outStream; } throw new Exception(string.Format("Unable to find resource stream {0}",resourceName)); } public string FileName { get { return _fileName; } set { _fileName = value; } } protected virtual void Dispose(bool disposing) { if (!this._disposedValue) { if (disposing) { if (File.Exists(_fileName)) { File.Delete(_fileName); } } } this._disposedValue = true; } #region IDisposable Members public void Dispose() { // Do not change this code.Put cleanup code in Dispose(bool disposing) above. Dispose(true); GC.SuppressFinalize(this); } #endregion }