Exemplo n.º 1
0
        public static bool HasAnyPostcondition(this IMethodSymbol @this, SemanticModel model)
        {
            if (@this == null)
            {
                throw new ArgumentNullException(nameof(@this));
            }
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            return(@this
                   .DeclaredAndInheritedAttributes()
                   .Any(a => a.IsContractAttribute(model)));
        }
Exemplo n.º 2
0
        public static IEnumerable <Contract> GetPostconditions(this IMethodSymbol @this, SemanticModel model, IContractProvider contractProvider)
        {
            if (@this == null)
            {
                throw new ArgumentNullException(nameof(@this));
            }
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }
            if (contractProvider == null)
            {
                throw new ArgumentNullException(nameof(contractProvider));
            }

            return(@this
                   .DeclaredAndInheritedAttributes()
                   .Where(a => a.IsContractAttribute(model))
                   .Select(a => contractProvider[a.AttributeClass.Name.ToString().Trim()]));
        }