예제 #1
0
        private bool IsExpandableProperty(string code)
        {
            var document = CreateDocument(code);
            var property = document.GetSyntaxRootAsync().Result.DescendantNodes().OfType <PropertyDeclarationSyntax>().First();

            return(ExpansionChecker.GetExpandablePropertyInfo(property, document.GetSemanticModelAsync().Result) != null);
        }
예제 #2
0
        public void TryGetAccessors4()
        {
            const string Code = "class C { int P { get; set; }";

            var property = SyntaxFactory.ParseCompilationUnit(Code).DescendantNodes().OfType <PropertyDeclarationSyntax>().First();

            AccessorDeclarationSyntax getter;
            AccessorDeclarationSyntax setter;
            var result = ExpansionChecker.TryGetAccessors(property, out getter, out setter);

            Assert.True(result);
        }