public void ProcessSolutionWithDependenciesBetweenProjectsInfo()
        {
            const String    solutionFilename       = "..\\..\\..\\Examples\\LibraryDependenciesExample\\LibraryDependenciesExample.sln";
            ExecutionResult executionResult        = ExecutionHelper.Execute(solutionFilename, null, OutputLevel.Info);
            String          solutionDirPath        = Path.GetFullPath(Path.Combine(EnvironmentHelper.GetContainedDirectory(), "..\\..\\..\\Examples\\LibraryDependenciesExample"));
            const String    expectedOutputTemplate = "Processing of the solution {0} is started\r\n" +
                                                     "Processing of the project {1}\\SomeLibrary\\SomeLibrary.csproj is started\r\n" +
                                                     SourceCheckUtilOutputDef.CompilationCheckSuccessOutput +
                                                     "Processing of the file {1}\\SomeLibrary\\SomeBaseClass.cs is started\r\n" +
                                                     SourceCheckUtilOutputDef.BadFilenameCaseAnalyzerSuccessOutput +
                                                     SourceCheckUtilOutputDef.CastToSameTypeAnalyzerSuccessOutput +
                                                     SourceCheckUtilOutputDef.NonAsciiIdentifiersAnalyzerSuccessOutput +
                                                     "Processing of the file {1}\\SomeLibrary\\SomeBaseClass.cs is finished\r\n" +
                                                     "Processing of the project {1}\\SomeLibrary\\SomeLibrary.csproj is finished\r\n" +
                                                     "Processing of the project {1}\\DependentLibrary\\DependentLibrary.csproj is started\r\n" +
                                                     SourceCheckUtilOutputDef.CompilationCheckSuccessOutput +
                                                     "Processing of the file {1}\\DependentLibrary\\SomeDerivedClass.cs is started\r\n" +
                                                     SourceCheckUtilOutputDef.BadFilenameCaseAnalyzerSuccessOutput +
                                                     SourceCheckUtilOutputDef.CastToSameTypeAnalyzerSuccessOutput +
                                                     SourceCheckUtilOutputDef.NonAsciiIdentifiersAnalyzerSuccessOutput +
                                                     "Processing of the file {1}\\DependentLibrary\\SomeDerivedClass.cs is finished\r\n" +
                                                     "Processing of the project {1}\\DependentLibrary\\DependentLibrary.csproj is finished\r\n" +
                                                     "Processing of the solution {0} is finished\r\n" +
                                                     "Result of analysis: analysis is succeeded\r\n";
            String expectedOutput = String.Format(expectedOutputTemplate, solutionFilename, solutionDirPath);

            ExecutionChecker.Check(executionResult, 0, expectedOutput, "");
        }
        public void ProcessBadExampleProjectWarning()
        {
            ExecutionResult executionResult        = ExecutionHelper.Execute("..\\..\\..\\Examples\\BadExample\\BadExample.csproj", null, OutputLevel.Warning);
            const String    expectedOutputTemplate = "{0}\\CastsExample.cs(26): [ERROR]: Found cast to the same type \"string\"\r\n" +
                                                     "{0}\\CastsExample.cs(24): [WARNING]: Found cast to the same type \"int\"\r\n" +
                                                     "{0}\\CastsExample.cs(29): [WARNING]: Found cast to the same type \"BadExample.SomeBaseClass\"\r\n" +
                                                     "{0}\\ClassnameExample.cs(3): [ERROR]: Found type named \"BadExample.ClassNameExample\" which corresponds the filename \"ClassnameExample.cs\" only at ignoring case\r\n" +
                                                     "{0}\\ClassnameExample.cs(7): [ERROR]: Found type named \"BadExample.Classnameexample\" which corresponds the filename \"ClassnameExample.cs\" only at ignoring case\r\n" +
                                                     "{0}\\IdentifiersExample.cs(7): [ERROR]: Found non-ASCII identifier \"SоmeSimpleClassA\"\r\n" +
                                                     "{0}\\IdentifiersExample.cs(15): [ERROR]: Found non-ASCII identifier \"TPаrаm1\"\r\n" +
                                                     "{0}\\IdentifiersExample.cs(19): [ERROR]: Found non-ASCII identifier \"ISomеInterface\"\r\n" +
                                                     "{0}\\IdentifiersExample.cs(23): [ERROR]: Found non-ASCII identifier \"ISomеInterface\"\r\n" +
                                                     "{0}\\IdentifiersExample.cs(29): [ERROR]: Found non-ASCII identifier \"SоmeSimpleClassA\"\r\n" +
                                                     "{0}\\IdentifiersExample.cs(29): [ERROR]: Found non-ASCII identifier \"SоmeSimpleClassA\"\r\n" +
                                                     "{0}\\IdentifiersExample.cs(30): [ERROR]: Found non-ASCII identifier \"somеObjB\"\r\n" +
                                                     "{0}\\IdentifiersExample.cs(31): [ERROR]: Found non-ASCII identifier \"SоmeSimpleClassA\"\r\n" +
                                                     "{0}\\IdentifiersExample.cs(31): [ERROR]: Found non-ASCII identifier \"SоmeSimpleClassA\"\r\n" +
                                                     "{0}\\IdentifiersExample.cs(32): [ERROR]: Found non-ASCII identifier \"someImplОbj\"\r\n" +
                                                     "{0}\\IdentifiersExample.cs(33): [ERROR]: Found non-ASCII identifier \"SоmeSimpleClassA\"\r\n" +
                                                     "{0}\\IdentifiersExample.cs(33): [ERROR]: Found non-ASCII identifier \"локальноеДействие\"\r\n" +
                                                     "{0}\\IdentifiersExample.cs(33): [ERROR]: Found non-ASCII identifier \"парам1\"\r\n" +
                                                     "{0}\\IdentifiersExample.cs(33): [ERROR]: Found non-ASCII identifier \"парам2\"\r\n";
            String projectPath    = Path.GetFullPath(Path.Combine(EnvironmentHelper.GetContainedDirectory(), "..\\..\\..\\Examples\\BadExample"));
            String expectedOutput = String.Format(expectedOutputTemplate, projectPath);

            ExecutionChecker.Check(executionResult, -1, expectedOutput, "");
        }
        public void ProcessBadExampleProjectInfo()
        {
            const String    projectFilename        = "..\\..\\..\\Examples\\BadExample\\BadExample.csproj";
            ExecutionResult executionResult        = ExecutionHelper.Execute("..\\..\\..\\Examples\\BadExample\\BadExample.csproj", null, OutputLevel.Info);
            const String    expectedOutputTemplate = "Processing of the project {0} is started\r\n" +
                                                     SourceCheckUtilOutputDef.CompilationCheckSuccessOutput +
                                                     "Processing of the file {1}\\CastsExample.cs is started\r\n" +
                                                     SourceCheckUtilOutputDef.BadFilenameCaseAnalyzerSuccessOutput +
                                                     "Execution of CastToSameTypeAnalyzer started\r\n" +
                                                     "Found 1 casts leading to errors in the ported C++ code\r\n" +
                                                     "{1}\\CastsExample.cs(26): [ERROR]: Found cast to the same type \"string\"\r\n" +
                                                     "Found 2 casts to the same type not leading to errors in the ported C++ code\r\n" +
                                                     "{1}\\CastsExample.cs(24): [WARNING]: Found cast to the same type \"int\"\r\n" +
                                                     "{1}\\CastsExample.cs(29): [WARNING]: Found cast to the same type \"BadExample.SomeBaseClass\"\r\n" +
                                                     "Execution of CastToSameTypeAnalyzer finished\r\n" +
                                                     SourceCheckUtilOutputDef.NonAsciiIdentifiersAnalyzerSuccessOutput +
                                                     "Processing of the file {1}\\CastsExample.cs is finished\r\n" +
                                                     "Processing of the file {1}\\ClassnameExample.cs is started\r\n" +
                                                     "Execution of BadFilenameCaseAnalyzer started\r\n" +
                                                     "File doesn't contain any type with name exact match to the filename, but contains 2 types with names match to the filename with ignoring case\r\n" +
                                                     "{1}\\ClassnameExample.cs(3): [ERROR]: Found type named \"BadExample.ClassNameExample\" which corresponds the filename \"ClassnameExample.cs\" only at ignoring case\r\n" +
                                                     "{1}\\ClassnameExample.cs(7): [ERROR]: Found type named \"BadExample.Classnameexample\" which corresponds the filename \"ClassnameExample.cs\" only at ignoring case\r\n" +
                                                     "Execution of BadFilenameCaseAnalyzer finished\r\n" +
                                                     SourceCheckUtilOutputDef.CastToSameTypeAnalyzerSuccessOutput +
                                                     SourceCheckUtilOutputDef.NonAsciiIdentifiersAnalyzerSuccessOutput +
                                                     "Processing of the file {1}\\ClassnameExample.cs is finished\r\n" +
                                                     "Processing of the file {1}\\IdentifiersExample.cs is started\r\n" +
                                                     SourceCheckUtilOutputDef.BadFilenameCaseAnalyzerSuccessOutput +
                                                     SourceCheckUtilOutputDef.CastToSameTypeAnalyzerSuccessOutput +
                                                     "Execution of NonAsciiIdentifiersAnalyzer started\r\n" +
                                                     "Found 14 non-ASCII identifiers leading to errors in the ported C++ code\r\n" +
                                                     "{1}\\IdentifiersExample.cs(7): [ERROR]: Found non-ASCII identifier \"SоmeSimpleClassA\"\r\n" +
                                                     "{1}\\IdentifiersExample.cs(15): [ERROR]: Found non-ASCII identifier \"TPаrаm1\"\r\n" +
                                                     "{1}\\IdentifiersExample.cs(19): [ERROR]: Found non-ASCII identifier \"ISomеInterface\"\r\n" +
                                                     "{1}\\IdentifiersExample.cs(23): [ERROR]: Found non-ASCII identifier \"ISomеInterface\"\r\n" +
                                                     "{1}\\IdentifiersExample.cs(29): [ERROR]: Found non-ASCII identifier \"SоmeSimpleClassA\"\r\n" +
                                                     "{1}\\IdentifiersExample.cs(29): [ERROR]: Found non-ASCII identifier \"SоmeSimpleClassA\"\r\n" +
                                                     "{1}\\IdentifiersExample.cs(30): [ERROR]: Found non-ASCII identifier \"somеObjB\"\r\n" +
                                                     "{1}\\IdentifiersExample.cs(31): [ERROR]: Found non-ASCII identifier \"SоmeSimpleClassA\"\r\n" +
                                                     "{1}\\IdentifiersExample.cs(31): [ERROR]: Found non-ASCII identifier \"SоmeSimpleClassA\"\r\n" +
                                                     "{1}\\IdentifiersExample.cs(32): [ERROR]: Found non-ASCII identifier \"someImplОbj\"\r\n" +
                                                     "{1}\\IdentifiersExample.cs(33): [ERROR]: Found non-ASCII identifier \"SоmeSimpleClassA\"\r\n" +
                                                     "{1}\\IdentifiersExample.cs(33): [ERROR]: Found non-ASCII identifier \"локальноеДействие\"\r\n" +
                                                     "{1}\\IdentifiersExample.cs(33): [ERROR]: Found non-ASCII identifier \"парам1\"\r\n" +
                                                     "{1}\\IdentifiersExample.cs(33): [ERROR]: Found non-ASCII identifier \"парам2\"\r\n" +
                                                     "Execution of NonAsciiIdentifiersAnalyzer finished\r\n" +
                                                     "Processing of the file {1}\\IdentifiersExample.cs is finished\r\n" +
                                                     "Processing of the project {0} is finished\r\n" +
                                                     "Result of analysis: analysis is failed\r\n";
            String projectDirPath = Path.GetFullPath(Path.Combine(EnvironmentHelper.GetContainedDirectory(), "..\\..\\..\\Examples\\BadExample"));
            String expectedOutput = String.Format(expectedOutputTemplate, projectFilename, projectDirPath);

            ExecutionChecker.Check(executionResult, -1, expectedOutput, "");
        }
        public void ProcessGoodExampleProjectWarning()
        {
            ExecutionResult executionResult        = ExecutionHelper.Execute("..\\..\\..\\Examples\\GoodExample\\GoodExample.csproj", null, OutputLevel.Warning);
            String          projectPath            = Path.GetFullPath(Path.Combine(EnvironmentHelper.GetContainedDirectory(), "..\\..\\..\\Examples\\GoodExample"));
            const String    expectedOutputTemplate = "{0}\\CastsExample.cs(24): [WARNING]: Found cast to the same type \"int\"\r\n" +
                                                     "{0}\\CastsExample.cs(28): [WARNING]: Found cast to the same type \"GoodExample.SomeBaseClass\"\r\n" +
                                                     "{0}\\ClassNameExample.cs(7): [WARNING]: Found type named \"GoodExample.Classnameexample\" which corresponds the filename \"ClassNameExample.cs\" only at ignoring case\r\n";
            String expectedOutput = String.Format(expectedOutputTemplate, projectPath);

            ExecutionChecker.Check(executionResult, 0, expectedOutput, "");
        }
예제 #5
0
        public void ProcessWithoutConfig()
        {
            ExecutionResult executionResult        = ExecutionHelper.Execute("..\\..\\..\\Examples\\ConfigUsageExample\\ConfigUsageExample.sln", null, OutputLevel.Error);
            const String    expectedOutputTemplate = "{0}\\Exclude\\BadIdentifierExample.cs(7): [ERROR]: Found non-ASCII identifier \"sоmеVаr\"\r\n" +
                                                     "{0}\\Exclude\\BadIdentifierExample.cs(8): [ERROR]: Found non-ASCII identifier \"sоmеОthеrVаr\"\r\n" +
                                                     "{0}\\Exclude\\BadIdentifierExample.cs(9): [ERROR]: Found non-ASCII identifier \"переменная\"\r\n" +
                                                     "{0}\\Include\\BadCastsExample.cs(8): [ERROR]: Found cast to the same type \"string\"\r\n" +
                                                     "{0}\\Only\\BadClassNameExample.cs(3): [ERROR]: Found type named \"FilesProcessingExample.Only.BadClassnameExample\" which corresponds the filename \"BadClassNameExample.cs\" only at ignoring case\r\n" +
                                                     "{0}\\Only\\BadClassNameExample.cs(7): [ERROR]: Found type named \"FilesProcessingExample.Only.BadClassNameexample\" which corresponds the filename \"BadClassNameExample.cs\" only at ignoring case\r\n";
            String projectDirectoryFullPath = Path.GetFullPath(Path.Combine(EnvironmentHelper.GetContainedDirectory(), "..\\..\\..\\Examples\\ConfigUsageExample\\FilesProcessingExample"));
            String expectedOutput           = String.Format(expectedOutputTemplate, projectDirectoryFullPath);

            ExecutionChecker.Check(executionResult, -1, expectedOutput, "");
        }
        public void ProcessGoodExampleProjectInfo()
        {
            const String    projectFilename        = "..\\..\\..\\Examples\\GoodExample\\GoodExample.csproj";
            ExecutionResult executionResult        = ExecutionHelper.Execute(projectFilename, null, OutputLevel.Info);
            String          projectDirPath         = Path.GetFullPath(Path.Combine(EnvironmentHelper.GetContainedDirectory(), "..\\..\\..\\Examples\\GoodExample"));
            const String    expectedOutputTemplate = "Processing of the project {0} is started\r\n" +
                                                     SourceCheckUtilOutputDef.CompilationCheckSuccessOutput +
                                                     "Processing of the file {1}\\CastsExample.cs is started\r\n" +
                                                     SourceCheckUtilOutputDef.BadFilenameCaseAnalyzerSuccessOutput +
                                                     "Execution of CastToSameTypeAnalyzer started\r\n" +
                                                     "Found 0 casts leading to errors in the ported C++ code\r\n" +
                                                     "Found 2 casts to the same type not leading to errors in the ported C++ code\r\n" +
                                                     "{1}\\CastsExample.cs(24): [WARNING]: Found cast to the same type \"int\"\r\n" +
                                                     "{1}\\CastsExample.cs(28): [WARNING]: Found cast to the same type \"GoodExample.SomeBaseClass\"\r\n" +
                                                     "Execution of CastToSameTypeAnalyzer finished\r\n" +
                                                     SourceCheckUtilOutputDef.NonAsciiIdentifiersAnalyzerSuccessOutput +
                                                     "Processing of the file {1}\\CastsExample.cs is finished\r\n" +
                                                     "Processing of the file {1}\\ClassNameExample.cs is started\r\n" +
                                                     "Execution of BadFilenameCaseAnalyzer started\r\n" +
                                                     "File contains 1 types with names match to the filename with ignoring case\r\n" +
                                                     "{1}\\ClassNameExample.cs(7): [WARNING]: Found type named \"GoodExample.Classnameexample\" which corresponds the filename \"ClassNameExample.cs\" only at ignoring case\r\n" +
                                                     "Execution of BadFilenameCaseAnalyzer finished\r\n" +
                                                     SourceCheckUtilOutputDef.CastToSameTypeAnalyzerSuccessOutput +
                                                     SourceCheckUtilOutputDef.NonAsciiIdentifiersAnalyzerSuccessOutput +
                                                     "Processing of the file {1}\\ClassNameExample.cs is finished\r\n" +
                                                     "Processing of the file {1}\\IdentifiersExample.cs is started\r\n" +
                                                     SourceCheckUtilOutputDef.BadFilenameCaseAnalyzerSuccessOutput +
                                                     SourceCheckUtilOutputDef.CastToSameTypeAnalyzerSuccessOutput +
                                                     SourceCheckUtilOutputDef.NonAsciiIdentifiersAnalyzerSuccessOutput +
                                                     "Processing of the file {1}\\IdentifiersExample.cs is finished\r\n" +
                                                     "Processing of the project {0} is finished\r\n" +
                                                     "Result of analysis: analysis is succeeded\r\n";
            String expectedOutput = String.Format(expectedOutputTemplate, projectFilename, projectDirPath);

            ExecutionChecker.Check(executionResult, 0, expectedOutput, "");
        }