Esempio n. 1
0
        private void CheckCommandProperty(CommonProperty commandProperty)
        {
            if (commandProperty.IsNot(typeof(ICommand)) || commandProperty.IsNot(typeof(RelayCommand)))
            {
                const string errorMessage = "Patching command property type must be ICommand or RelayCommand";

                log.Error(errorMessage);
                throw new PropertyPatchingException(errorMessage, commandProperty.FullName);
            }

            if (char.IsLower(commandProperty.Name.First()))
            {
                const string errorMessage = "First character of property name must be to upper case";

                log.Error(errorMessage);
                throw new PropertyPatchingException(errorMessage, commandProperty.FullName);
            }

            // ReSharper disable once InvertIf
            if (!commandProperty.Name.EndsWith(commandPropertyEndsWith))
            {
                var errorMessage = $"Patching command property name must be ends with '{commandPropertyEndsWith}'";

                log.Error(errorMessage);
                throw new PropertyPatchingException(errorMessage, commandProperty.FullName);
            }
        }