public void AzureDevOpsPersonalAccessTokenValidator_CheckInvalidInput() { string[] invalidInputs = new[] { "a", string.Empty }; foreach (string input in invalidInputs) { string matchedPattern = input; var groups = new Dictionary <string, string>(); string failureLevel = "Error"; string fingerprintText = null, message = null; Assert.Throws <ArgumentException>(() => AdoPatValidator.IsValidStatic(ref matchedPattern, ref groups, ref failureLevel, ref fingerprintText, ref message)); } }
public void AzureDevOpsPersonalAccessTokenValidator_IsValidBasic() { var failedTestCases = new List <string>(); foreach (TestCase testCase in s_coreTestCases) { bool performDynamicValidation = testCase.PerformDynamicValidation; string failureLevel = testCase.FailureLevel; string fingerprintText = null, message = null; var groups = new Dictionary <string, string>(); string state = AdoPatValidator.IsValidStatic(ref testCase.Input, ref groups, ref failureLevel, ref fingerprintText, ref message); string title = testCase.Title; Verify(state == testCase.ExpectedValidationState, title, failedTestCases); Verify(failureLevel == testCase.FailureLevel, title, failedTestCases); Verify(state == testCase.ExpectedValidationState, title, failedTestCases); if (state != "Unknown") { Verify(fingerprintText == null, title, failedTestCases); } else { Verify(fingerprintText == $"[pat/vs={testCase.Input}]", title, failedTestCases); } } failedTestCases.Should().BeEmpty(); }