18 October 2021 by jr101dallas
⇠ Back to PostsComponent
Back on coding! Well, roguelike coding anyway, not to insult the infrastructure as code guys doing the workflow and pipeline ci/cd work OR the web developers out there. But, those weren’t what I was really trying to do.
Component! It’s time to add a Component.
Basics
I planned out my work first, in the last post, so I’m doing now. I’m creating an empty Interface, an empty Class, and a test that for now looks a little silly because it’s just going to check that the Class implements the Interface.
public interface IComponent
{
}
public class Component
{
}
[TestMethod]
public void DefaultComponentIsIComponent()
{
var component = new Component();
Assert.IsTrue(component is IComponent);
}
I’m sure you see where the failure for the test is happening, so I’ll hook up the implementation and make the test pass.
public class Component : IComponent
{
}
Commit
These are tiny incremental changes. But, as I’ve said before I’m working in tiny bite sized chunks and this is a good place to stop and commit and capture my progress. I’m using git so that looks like this if you don’t already know.
Check which files I’ve changed or added.
git status
If I only see my expected changes, and there should only be three since I’m keeping things really small: Component.cs, IComponent.cs, and ComponentTests.cs. Yep, those are the three I see in the status so, add, commit, push.
git add .
git commit -m "add Components"
git push origin