I would have done something like this:
private void LetsDoIt()
{
while(TestedAndOk() == false)
{
WriteSomeCode();
}
}
And if you are facing problems in starting/writing code, I would refer to msdn, cp, google. In this case, I would start with this
article [
^]on CP.