public void CanAddFunctionWrapperAroundJson()
        {
            var jsonTweaker = new JsonTweaker(FileSystem);
            string filePath = @"d:\output\pickledFeatures.json";
            jsonTweaker.AddJsonPWrapperTo(filePath);

            var expected = "jsonPWrapper (\r\n[]\r\n);";
            Assert.AreEqual(expected, File.ReadAllText(filePath));
        }
Exemplo n.º 2
0
        private void TweakJsonFile()
        {
            var jsonBuilder = new JSONDocumentationBuilder(configuration, testResults, this.fileSystem);
            var jsonFilePath = jsonBuilder.OutputFilePath;

            var tweaker = new JsonTweaker(this.fileSystem);
            tweaker.AddJsonPWrapperTo(jsonFilePath);
            tweaker.RenameFileTo(jsonFilePath, jsonFilePath.Replace(".json", ".js"));
        }
        private void TweakJsonFile()
        {
            var jsonBuilder  = new JSONDocumentationBuilder(configuration, testResults, this.fileSystem);
            var jsonFilePath = jsonBuilder.OutputFilePath;

            var tweaker = new JsonTweaker(this.fileSystem);

            tweaker.AddJsonPWrapperTo(jsonFilePath);
            tweaker.RenameFileTo(jsonFilePath, jsonFilePath.Replace(".json", ".js"));
        }
        public void CanRenameJsonFile()
        {
            var jsonTweaker = new JsonTweaker(FileSystem);
            string oldfilePath = @"d:\output\pickledFeatures.json";
            string newFilePath = @"d:\output\pickledFeatures.js";
            jsonTweaker.RenameFileTo(oldfilePath, newFilePath);

            Assert.IsTrue(File.Exists(newFilePath));
            Assert.IsFalse(File.Exists(oldfilePath));
        }
        public void CanAddFunctionWrapperAroundJson()
        {
            string filePath = @"d:\output\pickledFeatures.json";
            FileSystem.AddFile(filePath, "\r\n[]\r\n");

            var jsonTweaker = new JsonTweaker(FileSystem);
            jsonTweaker.AddJsonPWrapperTo(filePath);

            var expected = "jsonPWrapper (\r\n[]\r\n);";
            var actual = FileSystem.File.ReadAllText(filePath);

            Check.That(actual).IsEqualTo(expected);
        }
        public void CanRenameJsonFile()
        {
            string oldfilePath = @"d:\output\pickledFeatures.json";
            string newFilePath = @"d:\output\pickledFeatures.js";

            MockFileSystem.AddFile(oldfilePath, "test data");

            var jsonTweaker = new JsonTweaker(MockFileSystem);
            jsonTweaker.RenameFileTo(oldfilePath, newFilePath);

            Assert.IsTrue(MockFileSystem.File.Exists(newFilePath));
            Assert.IsFalse(MockFileSystem.File.Exists(oldfilePath));
        }
        public void CanRenameJsonFile()
        {
            string oldfilePath = @"d:\output\pickledFeatures.json";
            string newFilePath = @"d:\output\pickledFeatures.js";

            FileSystem.AddFile(oldfilePath, "test data");

            var jsonTweaker = new JsonTweaker(FileSystem);
            jsonTweaker.RenameFileTo(oldfilePath, newFilePath);

            var doesNewPathExist = FileSystem.File.Exists(newFilePath);
            Check.That(doesNewPathExist).IsTrue();
            var doesOldPathExist = FileSystem.File.Exists(oldfilePath);
            Check.That(doesOldPathExist).IsFalse();
        }