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)); }
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)); }
public static KspObject LoadFromText(String craftFileText) { return(KspObjectReader.ReadObject(KspTokenReader.ReadToken(craftFileText))); }