Ejemplo n.º 1
0
        public async Task MigrateClassAsync_Correctly_Builds_Complex_Startup_Class()
        {
            var complexSyntaxTree    = SyntaxFactory.ParseSyntaxTree(InputComplexClassText);
            var complexSemanticModel = CSharpCompilation.Create("TestCompilation", new[] { complexSyntaxTree }).GetSemanticModel(complexSyntaxTree);
            var complexClassDec      = complexSyntaxTree.GetRoot().DescendantNodes().OfType <ClassDeclarationSyntax>().Single();
            var complexTypeSymbol    = complexSemanticModel.GetDeclaredSymbol(complexClassDec);

            var complexConverter = new GlobalClassConverter(InputRelativePath,
                                                            ClassConverterSetupFixture.TestProjectDirectoryPath,
                                                            complexSemanticModel,
                                                            complexClassDec,
                                                            complexTypeSymbol,
                                                            new LifecycleManagerService(),
                                                            new TaskManagerService(),
                                                            new WebFormMetricContext());

            var fileInfo = (await complexConverter.MigrateClassAsync()).Single();
            var fileText = Encoding.UTF8.GetString(fileInfo.FileBytes);

            Assert.AreEqual(ExpectedOutputComplexClassText, fileText);
        }
Ejemplo n.º 2
0
        public async Task MigrateClassAsync_Maps_New_Relative_Path_To_Correct_Location()
        {
            var fileInfo = (await _converter.MigrateClassAsync()).Single();

            Assert.AreEqual(ExpectedOutputPath, fileInfo.RelativePath);
        }