diff --git a/src/MigrationTools.Clients.TfsObjectModel/Processors/Infra/TfsProcessor.cs b/src/MigrationTools.Clients.TfsObjectModel/Processors/Infra/TfsProcessor.cs index 08ec52200..ef2cbd46b 100644 --- a/src/MigrationTools.Clients.TfsObjectModel/Processors/Infra/TfsProcessor.cs +++ b/src/MigrationTools.Clients.TfsObjectModel/Processors/Infra/TfsProcessor.cs @@ -8,6 +8,7 @@ using MigrationTools; using MigrationTools.Clients; using MigrationTools.Enrichers; +using MigrationTools.Exceptions; using MigrationTools.Tools; namespace MigrationTools.Processors.Infrastructure @@ -19,9 +20,31 @@ protected TfsProcessor(IOptions options, TfsCommonTools tfsCom } - new public TfsTeamProjectEndpoint Source => (TfsTeamProjectEndpoint)base.Source; + new public TfsTeamProjectEndpoint Source + { + get + { + var endpoint = base.Source as TfsTeamProjectEndpoint; + if (endpoint == null) + { + throw new ConfigurationValidationException(Options, ValidateOptionsResult.Fail($"The Endpoint '{Options.SourceName}' specified for `{this.GetType().Name}` is of the wrong type! {nameof(TfsTeamProjectEndpoint)} was expected.")); + } + return endpoint; + } + } - new public TfsTeamProjectEndpoint Target => (TfsTeamProjectEndpoint)base.Target; + new public TfsTeamProjectEndpoint Target + { + get + { + var endpoint = base.Target as TfsTeamProjectEndpoint; + if (endpoint == null) + { + throw new ConfigurationValidationException(Options, ValidateOptionsResult.Fail($"The Endpoint '{Options.TargetName}' specified for `{this.GetType().Name}` is of the wrong type! {nameof(TfsTeamProjectEndpoint)} was expected.")); + } + return endpoint; + } + } new public TfsCommonTools CommonTools => (TfsCommonTools)base.CommonTools;