private ProjectTemplate InitProjectTemplateFromJsonConfig()
        {
            var files = FileFindHelpers.FindFilesAtOrAbovePath(_fileSystem, _rootPath, _templateSearchPattern);

            if (files.Count > 1)
            {
                throw new ArgumentException("Multiple config files found, make sure that there is only a single *_template.config file inside your project directory");
            }
            Console.WriteLine(_fileSystem.ReadAllText(files.First()));
            var template = JsonConvert.DeserializeObject <ProjectTemplate>(_fileSystem.ReadAllText(files.First()));

            return(template);
        }
Ejemplo n.º 2
0
        private static bool CheckFileDoesNotContain(IPhysicalFileSystem fs, JObject config, string outputPath)
        {
            string path = Path.Combine(outputPath, config["path"].ToString());
            string text = fs.ReadAllText(path);
            if (!text.Contains(config["text"].ToString()))
            {
                return true;
            }

            Console.Error.WriteLine($"Expected {path} to not contain {config["text"].ToString()} but it did");
            return false;
        }
Ejemplo n.º 3
0
        private static bool CheckFileContains(IPhysicalFileSystem fs, JObject config, string outputPath)
        {
            string path = Path.Combine(outputPath, config["path"].ToString());
            string text = fs.ReadAllText(path);

            if (text.Contains(config["text"].ToString()))
            {
                return(true);
            }

            Console.Error.WriteLine($"Expected {path} to contain {config["text"].ToString()} but it did not");
            Console.Error.WriteLine($"Actual content = {text}");

            return(false);
        }
Ejemplo n.º 4
0
        private static bool CheckFileContains(IPhysicalFileSystem fs, JObject config, string outputPath)
        {
            string path         = Path.Combine(outputPath, config["path"].ToString());
            string text         = fs.ReadAllText(path);
            string expectedText = config["text"].ToString();

            if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                expectedText = expectedText.Replace("\r\n", "\n");
            }

            if (text.Contains(expectedText))
            {
                return(true);
            }

            Console.Error.WriteLine($"Expected {path} to contain {expectedText} but it did not");
            Console.Error.WriteLine($"Actual content = {text}");

            return(false);
        }