Exemple #1
0
        private string GetText(IClass clazz)
        {
            var subjectAttribute = clazz.DescendantsAndSelf(x => x.GetContainingType() as IClass)
                                   .Select(x => x.GetAttributeData(MSpecUtility.SubjectAttributeFullName)).WhereNotNull().First();

            var subjectTypes = subjectAttribute.PositionParameters().Select(x => x.TypeValue).WhereNotNull();
            var subjectText  = subjectAttribute.PositionParameters().Select(x => x.ConstantValue.Value as string).WhereNotNull().FirstOrDefault();

            return(MSpecUtility.CreateText(clazz.ToCommon(), subjectTypes.SingleOrDefault()?.ToCommon(), subjectText));
        }
Exemple #2
0
        private string GetText(IMetadataTypeInfo type)
        {
            var subjectAttribute = type.DescendantsAndSelf(x => x.DeclaringType)
                                   .Select(x => x.GetAttributeData(MSpecUtility.SubjectAttributeFullName)).WhereNotNull().First();

            var subjectTypes = subjectAttribute.ConstructorArguments.Select(x => x.Value as IMetadataType).WhereNotNull();
            var subjectText  = subjectAttribute.ConstructorArguments.Select(x => x.Value as string).WhereNotNull().FirstOrDefault();

            return(MSpecUtility.CreateText(type.ToCommon(), subjectTypes.SingleOrDefault()?.ToCommon(), subjectText));
        }