Real Test Driven Development – Thinking of money

 

Right, so the program outline is

I run a balance sheet, so I know how much should be in my account at the bank, (they are never up to date) its a simple list of additions and subtractions with totals along the way.  The list only lasts a month, so its a sort of quick and dirty, balance sheet.

I want the program to reflect this, a way to input additions and subtractions, and display a balance. also it might be helpful if there was a way to have the standard bills, so at the start of the month I can request that the standard bills are added automatically.

Display should be simple, as I don’t want to have to write a help file.

as we are not going to store account details, numbers etc, I think that a simple database back end would be great, as in the future I want to have other programs that use this data for budgeting.

So its time to fire up visual studio.

I like to start with the business layer, its the easiest layer to test so its a good place to start. and by doing this I don’t have to think about how the interface or the storage will work.

after creating a c# class library project, I add a new folder to the project, called Unit Tests, I like to store the unit test classes with the project, I enclose the class definition within a #if(DEBUG) so that they are not included within a release version.

I then write a simple test, this is a safety net, if this fails then the setup for the unit tests is failing or they are not running correctly!,

I use nunit and Test Driven, to run my tests.  In visual studio I link the run tests command to [control][shift][T]. this means that my main commands are [control][shift][D] for Ghost doc, [control][shift][B] to build the project and  [control][shift][T] to run the tests. with all this I can just about develop without using the mouse.

ok so far I have a project with a single class in looking like

using NUnit.Framework;

namespace MoneyEngine.UnitTests
{
    [TestFixture]
    public class TestMoneyEngine 
    {
        [Test]
        public void Hook()
        {
            Assert.IsTrue(true);
        }
    }
}
I use this format for every test class I create. so when this passes we are ready to start creating.
 

Unknown's avatar

About Duncan Butler

I’m Duncan, an entrepreneur and co-founder behind nth.digital and The Puzzle Board, where I combine heritage‑focused creativity with modern technology. My work spans AI development, C# engineering, and collaborative problem‑solving with Squad, building smarter tools, streamlined workflows, and engaging digital experiences. Whether refining puzzle production systems or exploring new AI capabilities, I’m driven by creating practical, intuitive solutions that make technology feel effortless.
This entry was posted in Projects. Bookmark the permalink.

Leave a comment