Ejemplo n.º 1
0
        public static void WhenUnknown()
        {
            var editor = CreateDocumentEditor(@"
namespace N
{
}");

            Assert.AreEqual(CodeStyleResult.NotFound, CodeStyle.UsingDirectivesInsideNamespace(editor));
        }
Ejemplo n.º 2
0
        public static void UsingDirectiveInsideNamespace()
        {
            var editor = CreateDocumentEditor(@"
namespace N
{
    using System;
}");

            Assert.AreEqual(CodeStyleResult.Yes, CodeStyle.UsingDirectivesInsideNamespace(editor));
        }
Ejemplo n.º 3
0
        public static void WhenUnknown()
        {
            var syntaxTree = CSharpSyntaxTree.ParseText(@"
namespace N
{
}");

            var compilation   = CSharpCompilation.Create("test", new[] { syntaxTree }, Settings.Default.MetadataReferences);
            var semanticModel = compilation.GetSemanticModel(syntaxTree);

            Assert.AreEqual(CodeStyleResult.NotFound, CodeStyle.UsingDirectivesInsideNamespace(semanticModel));
        }
Ejemplo n.º 4
0
        public static void UsingDirectiveInsideAndOutsideNamespace()
        {
            var editor = CreateDocumentEditor(@"
using System;

namespace N
{
    using System.Collections;
}");

            Assert.AreEqual(CodeStyleResult.Mixed, CodeStyle.UsingDirectivesInsideNamespace(editor));
        }
Ejemplo n.º 5
0
        public static void UsingDirectiveInsideNamespace()
        {
            var syntaxTree = CSharpSyntaxTree.ParseText(@"
namespace N
{
    using System;
}");

            var compilation   = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes());
            var semanticModel = compilation.GetSemanticModel(syntaxTree);

            Assert.AreEqual(CodeStyleResult.Yes, CodeStyle.UsingDirectivesInsideNamespace(semanticModel));
        }
Ejemplo n.º 6
0
        public static void UsingDirectiveInsideAndOutsideNamespace()
        {
            var syntaxTree = CSharpSyntaxTree.ParseText(@"
using System;

namespace N
{
    using System.Collections;
}");

            var compilation   = CSharpCompilation.Create("test", new[] { syntaxTree }, Settings.Default.MetadataReferences);
            var semanticModel = compilation.GetSemanticModel(syntaxTree);

            Assert.AreEqual(CodeStyleResult.Mixed, CodeStyle.UsingDirectivesInsideNamespace(semanticModel));
        }