コード例 #1
0
        public void TestStations()
        {
            // Test stations data
            JObject response = DeserializeJsonResource <JObject>(Resources.edsmStations);

            List <Station> stations = fakeEdsmService.ParseStarMapStations(response);

            Assert.IsNotNull(stations);

            // Test Jameson Memorial
            Station station = stations.Find(s => s.name == "Jameson Memorial");

            Assert.AreEqual(65, station.EDSMID);
            Assert.AreEqual(128666762, station.marketId);
            Assert.AreEqual("Orbis Starport", station.Model.invariantName);
            Assert.AreEqual(324.925354M, station.distancefromstar);
            Assert.AreEqual("Pilots Federation", station.Faction.Allegiance.invariantName);
            Assert.AreEqual("Democracy", station.Faction.Government.invariantName);
            Assert.AreEqual("Pilots Federation Local Branch", station.Faction.name);
            Assert.AreEqual(80576, station.Faction.EDSMID);
            Assert.AreEqual(2, station.economies.Count);
            Assert.AreEqual("High Tech", station.economies[0]);
            Assert.AreEqual("Industrial", station.economies[1]);
            Assert.IsTrue((bool)station.hasmarket);
            Assert.IsTrue((bool)station.hasshipyard);
            Assert.IsTrue((bool)station.hasoutfitting);
            Assert.IsTrue((bool)station.hasdocking);
            Assert.IsTrue((bool)station.hasrearm);
            Assert.IsTrue((bool)station.hasrefuel);
            Assert.IsTrue((bool)station.hasrepair);
            Assert.IsTrue(station.stationServices.Exists(s => s.invariantName == "Commodities"));
            Assert.IsTrue(station.stationServices.Exists(s => s.invariantName == "Technology Broker"));
            Assert.AreEqual(1540189980, station.updatedat);
            Assert.AreEqual(1540189980, station.shipyardupdatedat);
            Assert.AreEqual(1540189980, station.commoditiesupdatedat);
            Assert.AreEqual(1540189980, station.outfittingupdatedat);

            // Test Jameson Base (Engineer's workshop)
            station = stations.Find(s => s.name == "Jameson Base");
            Assert.AreEqual(285, station.EDSMID);
            Assert.AreEqual(128679815, station.marketId);
            Assert.AreEqual("Surface Station", station.Model.invariantName);
            Assert.AreEqual(40.333652M, station.distancefromstar);
            Assert.AreEqual("Independent", station.Faction.Allegiance.invariantName);
            Assert.AreEqual("Engineer", station.Faction.Government.invariantName);
            Assert.AreEqual("Lori Jameson", station.Faction.name);
            Assert.IsNull(station.Faction.EDSMID);
            Assert.AreEqual(2, station.economies.Count);
            Assert.AreEqual("Colony", station.economies[0]);
            Assert.AreEqual("None", station.economies[1]);
            Assert.AreEqual(false, station.hasmarket);
            Assert.AreEqual(false, station.hasshipyard);
            Assert.IsTrue((bool)station.hasoutfitting);
            Assert.IsTrue((bool)station.hasdocking);
            Assert.IsTrue((bool)station.hasrearm);
            Assert.IsTrue((bool)station.hasrefuel);
            Assert.IsTrue((bool)station.hasrepair);
            Assert.IsTrue(station.stationServices.Exists(s => s.invariantName == "Contacts"));
            Assert.AreEqual(1540179943, station.updatedat);
            Assert.AreEqual(null, station.shipyardupdatedat);
            Assert.AreEqual(null, station.commoditiesupdatedat);
            Assert.AreEqual(1540179943, station.outfittingupdatedat);
        }