public void SolveCaptchas() { CircularCaptchaSolver solver = new CircularCaptchaSolver(); Assert.Equal(6, solver.Solve(new int[] { 1, 2, 1, 2 })); Assert.Equal(0, solver.Solve(new int[] { 1, 2, 2, 1 })); Assert.Equal(4, solver.Solve(new int[] { 1, 2, 3, 4, 2, 5 })); Assert.Equal(12, solver.Solve(new int[] { 1, 2, 3, 1, 2, 3 })); Assert.Equal(4, solver.Solve(new int[] { 1, 2, 1, 3, 1, 4, 1, 5 })); }
public void SolveCaptchasWithCircularSolver() { CircularCaptchaSolver solver = new CircularCaptchaSolver(); StringInputParser parser = new StringInputParser(); CaptchaService service = new CaptchaService(parser, solver); Assert.Equal(6, service.SolveCaptcha("1212")); Assert.Equal(0, service.SolveCaptcha("1221")); Assert.Equal(4, service.SolveCaptcha("123425")); Assert.Equal(12, service.SolveCaptcha("123123")); Assert.Equal(4, service.SolveCaptcha("12131415")); }
static void Main(string[] args) { // Part One FileInputParser parser = new FileInputParser(); SimpleCaptchaSolver solver = new SimpleCaptchaSolver(); CaptchaService service = new CaptchaService(parser, solver); Console.WriteLine(service.SolveCaptcha("inputs/part-one.txt")); // Part Two CircularCaptchaSolver circularSolver = new CircularCaptchaSolver(); CaptchaService circularService = new CaptchaService(parser, circularSolver); Console.WriteLine(circularService.SolveCaptcha("inputs/part-one.txt")); }