Junior — Senior
Testing the behavior of the LaunchRockets method
livecode
Task condition
How to write a unit test for the LaunchRockets method, allowing changes to the code structure: adding, removing, or modifying parts of it.
public class Defender
{
private RocketService rocketService;
public Defender()
{
rocketService = new RocketService();
}
public void Start()
{
rocketService.LaunchRockets();
}
}
public class RocketService
{
public void LaunchRockets()
{
if (DateTime.Now.Hour > 10)
{
// implementation of launching rockets
}
}
}