public void Reports_Error_For_Missing_File()
        {
            Linker = new ArmJsonLinker(InputFilePath, new PhysicalFileSystem(), Reporter);

            var relativePath = @"./../aresource.json";
            var input        = SimpleTemplateWithRelativeResource(relativePath);

            AddAResource();

            GenerateOutput(input);

            Assert.AreEqual(
                @"File not found at ./../aresource.json, resolved to absolute c:\users\user\source\repos\aresource.json",
                Reporter.Errors[0].error
                );
        }
Example #2
0
        protected override void ProcessRecord()
        {
            var inputPath = ResolvePath(InputPath);

            var linker = new ArmJsonLinker(inputPath, new PhysicalFileSystem(), this);
            var output = linker.LinkContent(File.ReadAllText(inputPath));

            if (String.IsNullOrWhiteSpace(OutputPath))
            {
                WriteObject(output);
            }
            else
            {
                File.WriteAllText(ResolvePath(OutputPath), output);
            }
        }
        public void Reports_Error_For_Invalid_Url()
        {
            Linker = new ArmJsonLinker(InputFilePath, new PhysicalFileSystem(), Reporter);

            var relativePath = @"file://something.wrong/here";
            var input        = SimpleTemplateWithRelativeResource(relativePath);

            AddAResource();

            GenerateOutput(input);

            Assert.AreEqual(
                @"The given path's format is not supported. file://something.wrong/here",
                Reporter.Errors[0].error,
                Reporter.Errors[0].error
                );
        }
Example #4
0
 public void Setup()
 {
     FileSystem = new FakeFileSystem();
     Reporter   = new FakeProgress();
     Linker     = new ArmJsonLinker(InputFilePath, FileSystem, Reporter);
 }