Example #1
0
        public void CanLoadCraftFromCraftFileString()
        {
            // given
            var textIn = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("KSPPartRemover.Tests.Resources.Mün Mk I.in.craft")).ReadToEnd();

            // when
            var craft = CraftLoader.LoadFromText(textIn);

            // then
            Assert.That((craft as KspCraftObject).Name, Is.EqualTo("Mün Mk I"));
        }
Example #2
0
        public void ReturnsEmptyObjectTreeForEmptyFile()
        {
            // given
            var textIn = "";

            // when
            var kspObjTree = CraftLoader.LoadFromText(textIn);

            // then
            Assert.That(kspObjTree.Type, Is.Empty);
            Assert.That(kspObjTree.Children, Is.Empty);
        }
Example #3
0
        public void CanLoadCraftsFromSaveFileString()
        {
            // given
            var textIn = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("KSPPartRemover.Tests.Resources.Refuel at Minmus.in.sfs")).ReadToEnd();

            // when
            var kspObjTree = CraftLoader.LoadFromText(textIn);

            // then
            Assert.That(kspObjTree.Children <KspCraftObject> (recursive: true).Select(craft => craft.Name), Is.EqualTo(new[] {
                "Ast. HSJ-227",
                "Ast. LHV-865",
                "Ast. IQY-452",
                "Aeris 4B \"Maybe the Sky\"",
                "Ast. JCK-736",
                "Ast. JIH-531",
                "Ast. AYF-000",
                "Bowser 1",
                "Bowser 1 Debris",
                "Ast. JMV-788",
                "Bowser 1 Debris"
            }));
        }