コード例 #1
0
        public void PerformanceTest()
        {
            int           fileCount      = 100;
            ClassFormat   dummy          = ClassFormat.Dummy;
            CSVSerializer parser         = new CSVSerializer();
            string        testFolderPath = Path.Combine("./", nameof(PerformanceTest));

            Directory.CreateDirectory(testFolderPath);

            List <string> filePaths = new List <string>();

            for (int i = 0; i < fileCount; i++)
            {
                dummy.className = $"class_{i + 1}";
                string text = parser.Serialize(dummy);
                string path = Path.Combine(testFolderPath, $"{i + 1}.{parser.fileExtension}");
                filePaths.Add(path);
                File.WriteAllText(path, text);
            }

            ToCodeVerb codeCommand = new ToCodeVerb();

            codeCommand.inputPaths       = new string[] { testFolderPath };
            codeCommand.resultFolderPath = testFolderPath;
            codeCommand.fileName         = nameof(PerformanceTest);

            ToCodeVerb.Verb(codeCommand).Result.Should().Be(0);

            Directory.Delete(testFolderPath, true);
        }
コード例 #2
0
        public void WorkingTest()
        {
            ClassFormat   dummy  = ClassFormat.Dummy;
            CSVSerializer parser = new CSVSerializer();

            string text = parser.Serialize(dummy);
            string path = $"{nameof(WorkingTest)}.{parser.fileExtension}";

            File.WriteAllText(path, text);

            ToCodeVerb codeCommand = new ToCodeVerb();

            codeCommand.inputPaths = new string[] { path };
            codeCommand.fileName   = nameof(WorkingTest);

            ToCodeVerb.Verb(codeCommand).Result.Should().Be(0);

            File.Delete(Path.Combine(Directory.GetCurrentDirectory(), path));
            File.Delete(codeCommand.OutputFilePath());
        }