Exemplo n.º 1
0
 private static int ValidateToUpgradeModule(IOperation operation, int?moduleId, ModuleInfoEntity module, ModuleConfigurationFile configuration)
 {
     return(GetVerdict(operation, module.Version, configuration.Version) switch
     {
         ModuleConfigurationVerdict.Upgrade => moduleId ?? throw CommonExceptions.FailedToDefineModuleForUpgrade(operation),
         ModuleConfigurationVerdict.Installed => throw CommonExceptions.FailedToSubmitModuleConfiguration(operation, ModuleConfigurationVerdict.Installed),
         ModuleConfigurationVerdict.Downgrade => throw CommonExceptions.FailedToSubmitModuleConfiguration(operation, ModuleConfigurationVerdict.Downgrade),
         ModuleConfigurationVerdict.Updating => throw new ArgumentOutOfRangeException(),
         ModuleConfigurationVerdict.BrokenChanges => throw new ArgumentOutOfRangeException(),
         ModuleConfigurationVerdict.NewModule => throw new ArgumentOutOfRangeException(),
         _ => throw new ArgumentOutOfRangeException()
     });