-
-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve validation for TfsEndpoint PAT tokens and message (#2368)
Both @soodgautam and @nkofctg ran into issues with the `when you are migrating to Azure DevOps you MUST provide an PAT so that we can call the REST API for certain actions. For example, we would be unable to deal with a Work item Type change.` message! This was due to the `SourceName` and/or `TargetName` on the Processor being set to null. The validator now checks for this! It now checks for: - [X] `SourceName` and/or `TargetName` being Set - [X] `SourceName` and/or `TargetName` existing - [X] `SourceName` and/or `TargetName` of correct type
- Loading branch information
Showing
16 changed files
with
260 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 25 additions & 2 deletions
27
src/MigrationTools.Clients.TfsObjectModel/Endpoints/TfsLanguageMapOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,31 @@ | ||
namespace MigrationTools.Endpoints | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace MigrationTools.Endpoints | ||
{ | ||
public class TfsLanguageMapOptions | ||
public class TfsLanguageMapOptions : IValidateOptions<TfsLanguageMapOptions> | ||
{ | ||
public string AreaPath { get; set; } | ||
public string IterationPath { get; set; } | ||
|
||
public ValidateOptionsResult Validate(string name, TfsLanguageMapOptions options) | ||
{ | ||
var errors = new List<string>(); | ||
|
||
if (string.IsNullOrWhiteSpace(options.AreaPath)) | ||
{ | ||
errors.Add("The AreaPath property must not be null or empty."); | ||
} | ||
if (string.IsNullOrWhiteSpace(options.IterationPath)) | ||
{ | ||
errors.Add("The IterationPath property must not be null or empty."); | ||
} | ||
if (errors.Any()) | ||
{ | ||
ValidateOptionsResult.Fail(errors); | ||
} | ||
return ValidateOptionsResult.Success; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.