Exemplo n.º 1
0
        private bool SaveTestFile(TestFile testFile, string fileFullPath)
        {
            if (testFile.EngineVersion > _configuration.EngineVersion)
            {
                throw new InvalidEngineException("The file you are trying to save was built with a newer version of Syringe. Please update your copy of Syringe.");
            }

            testFile.EngineVersion = _configuration.EngineVersion;

            string contents = _testFileWriter.Write(testFile);

            return(_fileHandler.WriteAllText(fileFullPath, contents));
        }
Exemplo n.º 2
0
        public bool CreateTest(string filename, Test test)
        {
            string fullPath     = _fileHandler.GetFileFullPath(filename);
            string fileContents = _fileHandler.ReadAllText(fullPath);

            TestFile collection;

            using (var stringReader = new StringReader(fileContents))
            {
                collection = _testFileReader.Read(stringReader);

                collection.Tests = collection.Tests.Concat(new[] { test });
            }

            string contents = _testFileWriter.Write(collection);

            return(_fileHandler.WriteAllText(fullPath, contents));
        }