Exemple #1
0
        private static string InterfaceModuleBody(ExtractInterfaceModel model)
        {
            var interfaceMembers = string.Join(NewLines.DOUBLE_SPACE, model.SelectedMembers.Select(m => m.Body));
            var optionExplicit   = $"{Tokens.Option} {Tokens.Explicit}{Environment.NewLine}";

            var targetModule         = Declaration.GetModuleParent(model.TargetDeclaration);
            var folderAnnotation     = targetModule?.Annotations.FirstOrDefault(pta => pta.Annotation is FolderAnnotation);
            var folderAnnotationText = folderAnnotation != null
                                       ? $"'@{folderAnnotation.Context.GetText()}{Environment.NewLine}"
                                       : string.Empty;

            var exposedAnnotation     = new ExposedModuleAnnotation();
            var exposedAnnotationText = model.InterfaceInstancing == ClassInstancing.Public
                ? $"'@{exposedAnnotation.Name}{Environment.NewLine}"
                : string.Empty;

            var interfaceAnnotation     = new InterfaceAnnotation();
            var interfaceAnnotationText = $"'@{interfaceAnnotation.Name}{Environment.NewLine}";

            return($"{optionExplicit}{Environment.NewLine}{folderAnnotationText}{exposedAnnotationText}{interfaceAnnotationText}{Environment.NewLine}{interfaceMembers}");
        }
Exemple #2
0
        public void InterfaceAnnotation_TypeIsInterface()
        {
            var annotation = new InterfaceAnnotation(new QualifiedSelection(), null);

            Assert.AreEqual(AnnotationType.Interface, annotation.AnnotationType);
        }