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);
        }
Пример #2
0
        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));
        }
Пример #3
0
        public void CanAddFunctionWrapperAroundJson()
        {
            string filePath = @"d:\output\pickledFeatures.json";

            MockFileSystem.AddFile(filePath, "\r\n[]\r\n");

            var jsonTweaker = new JsonTweaker(MockFileSystem);

            jsonTweaker.AddJsonPWrapperTo(filePath);

            var expected = "jsonPWrapper (\r\n[]\r\n);";

            Assert.AreEqual(expected, MockFileSystem.File.ReadAllText(filePath));
        }
        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();
        }
Пример #5
0
        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);
        }
Пример #6
0
        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();
        }