www.bitwix.com

Bitwix


Software

Snippets

Test File Paths

Two techniques I use for making tests not dependent on a hard coded directory. TempDirectory gets the Windows directory - useful for output. GetExecutingPath() gets the directory for the DLL and so you build a path relative to that.
	private string TempDirectory { get { return Path.GetTempPath(); } }
        private string GetTestFilename()
        {
            return System.IO.Path.Combine(GetExecutingPath(), @"Test\Import\Files\MyFile.csv");
        }
        private string GetExecutingPath()
        {
            string executingPath = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
            string prefix = "file:///";
            if (executingPath.StartsWith(prefix))
                executingPath = executingPath.Substring(prefix.Length);
            executingPath = System.IO.Path.GetDirectoryName(executingPath);
            return executingPath;		
        }


Whitespace

Property Hawk

Projects

This layout has been adapted from an original design by Ruthsarian Layouts, downloaded from oswd.org