I have difficulty in many situations to come up with a good unit test names for classes and methods. Typically, I try to follow the form:
public class TestContext
{
[Fact]
public void WhenThis_DoThat()
{
}
}
Some put words Given, When, and Then on the parts to be explicit. I like it because it seems to make the unit test clearer on what it is that it's testing. Aside from considering BDD toolkits, I need some advice in how this can work with plain old xUnit tools.
I'm having especially hard time with scenarios like this:
When Application starts up, the main form loads and user sees a list of links which the user can click on.
or maybe a better use case scenario is:
User can select a link from a list of links.
I'm not certain but I'm trying to describe a behavior where you run an app and the form loads with a list of clickable links. And turning that into a unit test.
What is the Given, When, and Then for that?