Ejemplo n.º 1
0
        public void CanReadAndWriteKspObjectsFromSaveFileString()
        {
            // given
            var textIn = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("KSPPartRemover.Tests.Resources.Refuel at Minmus.in.sfs")).ReadToEnd();

            // when
            var tokenIn   = KspTokenReader.ReadToken(textIn);
            var kspObject = KspObjectReader.ReadObject(tokenIn);
            var tokenOut  = KspObjectWriter.WriteObject(kspObject);
            var textOut   = KspTokenWriter.WriteToken(tokenOut, new StringBuilder()).ToString();

            // then
            Assert.That(textOut, Is.EqualTo(textIn));
        }
Ejemplo n.º 2
0
        public void ReturnsEmptyObjectForEmptyFile()
        {
            // given
            var textIn = "";

            // when
            var tokenIn   = KspTokenReader.ReadToken(textIn);
            var kspObject = KspObjectReader.ReadObject(tokenIn);
            var tokenOut  = KspObjectWriter.WriteObject(kspObject);
            var textOut   = KspTokenWriter.WriteToken(tokenOut, new StringBuilder()).ToString();

            // then
            Assert.That(textOut, Is.EqualTo(textIn));
        }
Ejemplo n.º 3
0
 public static KspObject LoadFromText(String craftFileText)
 {
     return(KspObjectReader.ReadObject(KspTokenReader.ReadToken(craftFileText)));
 }