Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Checkpoint โ€” Debugging & testing

โญ beginnerโณ 20 min read๐Ÿ“ Lesson 69 of 85

A validator suite: implement the validators AND their discriminating tests โ€” every contract asserted from both directions.

Checkpoint: the validator suite

Task: implement in Solution:

  1. static bool IsValidUsername(string s) โ€” 3โ€“20 chars, letters/digits/underscore only, non-null. (Use char.IsLetterOrDigit / '_'.)
  2. static int ParsePort(string input) โ€” 1โ€“65535 after parsing; FormatException for non-numeric, ArgumentOutOfRangeException for out-of-range, null โ†’ ArgumentException.
  3. static List<int> DedupeSorted(List<int> nums) โ€” distinct values in ascending order; null/empty โ†’ empty list.