Ejemplo n.º 1
0
        public void TestMarket()
        {
            string resp = " { \"id\":3230605824,\"name\":\"Dunbar Ring\",\"outpostType\":\"starport\",\"imported\":{ \"128049197\":\"Polymers\",\"128049199\":\"Semiconductors\",\"128049175\":\"Copper\",\"128049190\":\"Leather\",\"128672302\":\"CeramicComposites\",\"128673850\":\"HydrogenPeroxide\",\"128049172\":\"Uranium\",\"128049193\":\"SyntheticFabrics\",\"128049176\":\"Aluminium\",\"128049171\":\"Tantalum\",\"128673851\":\"LiquidOxygen\",\"128049170\":\"Gallium\",\"128049173\":\"Lithium\",\"128049226\":\"HazardousEnvironmentSuits\",\"128049191\":\"NaturalFabrics\",\"128049177\":\"Algae\",\"128049174\":\"Titanium\",\"128682044\":\"ConductiveFabrics\",\"128671118\":\"Osmium\",\"128049154\":\"Gold\",\"128673857\":\"CoolingHoses\",\"128049166\":\"Water\",\"128049162\":\"Cobalt\",\"128049153\":\"Palladium\",\"128049180\":\"Grain\",\"128049200\":\"Superconductors\",\"128049214\":\"Beer\",\"128673847\":\"Samarium\",\"128673845\":\"Praseodymium\",\"128049227\":\"Robotics\",\"128049215\":\"Wine\",\"128049169\":\"Indium\",\"128049183\":\"Fish\",\"128673856\":\"CMMComposite\",\"128049168\":\"Beryllium\",\"128049155\":\"Silver\",\"128049228\":\"AutoFabricators\",\"128673855\":\"InsulatingMembrane\",\"128673866\":\"ExhaustManifold\",\"128682046\":\"AdvancedMedicines\",\"128049182\":\"Animalmeat\",\"128673861\":\"EmergencyPowerCells\",\"128049188\":\"Tea\",\"128049178\":\"FruitAndVegetables\",\"128673873\":\"MicroControllers\",\"128049185\":\"SyntheticMeat\",\"128049240\":\"ConsumerTechnology\",\"128049152\":\"Platinum\",\"128049669\":\"ProgenitorCells\",\"128049189\":\"Coffee\",\"128673848\":\"LowTemperatureDiamond\",\"128049209\":\"PerformanceEnhancers\",\"128049235\":\"ReactiveArmour\",\"128049236\":\"NonLethalWeapons\",\"128668550\":\"Painite\",\"128672306\":\"BootlegLiquor\"},\"exported\":{ \"128049217\":\"PowerGenerators\",\"128049223\":\"MarineSupplies\",\"128672307\":\"GeologicalEquipment\",\"128049202\":\"HydrogenFuel\",\"128049221\":\"MineralExtractors\",\"128049248\":\"Scrap\",\"128049241\":\"Clothing\",\"128064028\":\"AtmosphericExtractors\",\"128673860\":\"HNShockMount\",\"128049238\":\"DomesticAppliances\",\"128066403\":\"Drones\",\"128049222\":\"CropHarvesters\",\"128049184\":\"FoodCartridges\",\"128049218\":\"WaterPurifiers\",\"128672308\":\"ThermalCoolingUnits\",\"128049210\":\"BasicMedicines\",\"128049244\":\"Biowaste\",\"128672309\":\"BuildingFabricators\",\"128672313\":\"SkimerComponents\",\"128049225\":\"ComputerComponents\",\"128682048\":\"SurvivalEquipment\",\"128049233\":\"PersonalWeapons\",\"128049216\":\"Liquor\"},\"services\":{ \"dock\":\"ok\",\"contacts\":\"ok\",\"exploration\":\"ok\",\"commodities\":\"ok\",\"refuel\":\"ok\",\"repair\":\"ok\",\"rearm\":\"ok\",\"outfitting\":\"ok\",\"shipyard\":\"ok\",\"crewlounge\":\"ok\",\"powerplay\":\"ok\",\"searchrescue\":\"ok\"},\"economies\":{ \"36\":{ \"name\":\"Industrial\",\"proportion\":1} },\"prohibited\":{ \"128049670\":\"CombatStabilisers\",\"128049212\":\"BasicNarcotics\",\"128049213\":\"Tobacco\",\"128049234\":\"BattleWeapons\",\"128667728\":\"ImperialSlaves\",\"128049243\":\"Slaves\",\"128049245\":\"ToxicWaste\"},\"commodities\":[{\"id\":128049202,\"name\":\"HydrogenFuel\",\"legality\":\"\",\"buyPrice\":113,\"sellPrice\":108,\"meanPrice\":110,\"demandBracket\":0,\"stockBracket\":1,\"stock\":150631,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Chemicals\",\"locName\":\"Hydrogen Fuel\"},{\"id\":128673850,\"name\":\"HydrogenPeroxide\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":782,\"meanPrice\":917,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":1997893,\"statusFlags\":[],\"categoryname\":\"Chemicals\",\"locName\":\"Hydrogen Peroxide\"},{\"id\":128673851,\"name\":\"LiquidOxygen\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":200,\"meanPrice\":263,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":1109553,\"statusFlags\":[],\"categoryname\":\"Chemicals\",\"locName\":\"Liquid oxygen\"},{\"id\":128049166,\"name\":\"Water\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":145,\"meanPrice\":120,\"demandBracket\":2,\"stockBracket\":0,\"stock\":0,\"demand\":233842,\"statusFlags\":[],\"categoryname\":\"Chemicals\",\"locName\":\"Water\"},{\"id\":128049241,\"name\":\"Clothing\",\"legality\":\"\",\"buyPrice\":215,\"sellPrice\":198,\"meanPrice\":286,\"demandBracket\":0,\"stockBracket\":1,\"stock\":59200,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Consumer Items\",\"locName\":\"Clothing\"},{\"id\":128049240,\"name\":\"ConsumerTechnology\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":7066,\"meanPrice\":6766,\"demandBracket\":2,\"stockBracket\":0,\"stock\":0,\"demand\":17720,\"statusFlags\":[],\"categoryname\":\"Consumer Items\",\"locName\":\"Consumer Technology\"},{\"id\":128049238,\"name\":\"DomesticAppliances\",\"legality\":\"\",\"buyPrice\":441,\"sellPrice\":418,\"meanPrice\":488,\"demandBracket\":0,\"stockBracket\":1,\"stock\":35349,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Consumer Items\",\"locName\":\"Domestic Appliances\"},{\"id\":128682048,\"name\":\"SurvivalEquipment\",\"legality\":\"\",\"buyPrice\":377,\"sellPrice\":357,\"meanPrice\":486,\"demandBracket\":0,\"stockBracket\":2,\"stock\":3625,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Consumer Items\",\"locName\":\"Survival Equipment\"},{\"id\":128049177,\"name\":\"Algae\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":233,\"meanPrice\":137,\"demandBracket\":2,\"stockBracket\":0,\"stock\":0,\"demand\":458745,\"statusFlags\":[],\"categoryname\":\"Foods\",\"locName\":\"Algae\"},{\"id\":128049182,\"name\":\"Animalmeat\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":1515,\"meanPrice\":1293,\"demandBracket\":2,\"stockBracket\":0,\"stock\":0,\"demand\":35316,\"statusFlags\":[],\"categoryname\":\"Foods\",\"locName\":\"Animal Meat\"},{\"id\":128049189,\"name\":\"Coffee\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":1515,\"meanPrice\":1280,\"demandBracket\":2,\"stockBracket\":0,\"stock\":0,\"demand\":8829,\"statusFlags\":[],\"categoryname\":\"Foods\",\"locName\":\"Coffee\"},{\"id\":128049183,\"name\":\"Fish\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":480,\"meanPrice\":407,\"demandBracket\":2,\"stockBracket\":0,\"stock\":0,\"demand\":98667,\"statusFlags\":[],\"categoryname\":\"Foods\",\"locName\":\"Fish\"},{\"id\":128049184,\"name\":\"FoodCartridges\",\"legality\":\"\",\"buyPrice\":57,\"sellPrice\":44,\"meanPrice\":105,\"demandBracket\":0,\"stockBracket\":2,\"stock\":46048,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Foods\",\"locName\":\"Food Cartridges\"},{\"id\":128049178,\"name\":\"FruitAndVegetables\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":358,\"meanPrice\":313,\"demandBracket\":2,\"stockBracket\":0,\"stock\":0,\"demand\":31857,\"statusFlags\":[],\"categoryname\":\"Foods\",\"locName\":\"Fruit and Vegetables\"},{\"id\":128049180,\"name\":\"Grain\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":229,\"meanPrice\":210,\"demandBracket\":2,\"stockBracket\":0,\"stock\":0,\"demand\":212624,\"statusFlags\":[],\"categoryname\":\"Foods\",\"locName\":\"Grain\"},{\"id\":128049185,\"name\":\"SyntheticMeat\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":246,\"meanPrice\":271,\"demandBracket\":2,\"stockBracket\":0,\"stock\":0,\"demand\":20600,\"statusFlags\":[],\"categoryname\":\"Foods\",\"locName\":\"Synthetic Meat\"},{\"id\":128049188,\"name\":\"Tea\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":1718,\"meanPrice\":1468,\"demandBracket\":2,\"stockBracket\":0,\"stock\":0,\"demand\":32039,\"statusFlags\":[],\"categoryname\":\"Foods\",\"locName\":\"Tea\"},{\"id\":128673856,\"name\":\"CMMComposite\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":6563,\"meanPrice\":5998,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":126860,\"statusFlags\":[],\"categoryname\":\"Industrial Materials\",\"locName\":\"CMM Composite\"},{\"id\":128672302,\"name\":\"CeramicComposites\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":328,\"meanPrice\":231,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":2053017,\"statusFlags\":[],\"categoryname\":\"Industrial Materials\",\"locName\":\"Ceramic Composites\"},{\"id\":128673857,\"name\":\"CoolingHoses\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":1570,\"meanPrice\":1658,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":431324,\"statusFlags\":[],\"categoryname\":\"Industrial Materials\",\"locName\":\"Micro-weave Cooling Hoses\"},{\"id\":128673855,\"name\":\"InsulatingMembrane\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":11609,\"meanPrice\":10937,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":80310,\"statusFlags\":[],\"categoryname\":\"Industrial Materials\",\"locName\":\"Insulating Membrane\"},{\"id\":128049197,\"name\":\"Polymers\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":272,\"meanPrice\":172,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":3009599,\"statusFlags\":[],\"categoryname\":\"Industrial Materials\",\"locName\":\"Polymers\"},{\"id\":128049199,\"name\":\"Semiconductors\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":1214,\"meanPrice\":968,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":2777622,\"statusFlags\":[],\"categoryname\":\"Industrial Materials\",\"locName\":\"Semiconductors\"},{\"id\":128049200,\"name\":\"Superconductors\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":7428,\"meanPrice\":6613,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":262877,\"statusFlags\":[],\"categoryname\":\"Industrial Materials\",\"locName\":\"Superconductors\"},{\"id\":128064028,\"name\":\"AtmosphericExtractors\",\"legality\":\"\",\"buyPrice\":307,\"sellPrice\":285,\"meanPrice\":357,\"demandBracket\":0,\"stockBracket\":1,\"stock\":45837,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Machinery\",\"locName\":\"Atmospheric Processors\"},{\"id\":128672309,\"name\":\"BuildingFabricators\",\"legality\":\"\",\"buyPrice\":892,\"sellPrice\":860,\"meanPrice\":986,\"demandBracket\":0,\"stockBracket\":2,\"stock\":9967,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Machinery\",\"locName\":\"Building Fabricators\"},{\"id\":128049222,\"name\":\"CropHarvesters\",\"legality\":\"\",\"buyPrice\":2099,\"sellPrice\":2029,\"meanPrice\":2022,\"demandBracket\":0,\"stockBracket\":1,\"stock\":32472,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Machinery\",\"locName\":\"Crop Harvesters\"},{\"id\":128673861,\"name\":\"EmergencyPowerCells\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":2625,\"meanPrice\":2348,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":50747,\"statusFlags\":[],\"categoryname\":\"Machinery\",\"locName\":\"Emergency Power Cells\"},{\"id\":128673866,\"name\":\"ExhaustManifold\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":2059,\"meanPrice\":1890,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":61848,\"statusFlags\":[],\"categoryname\":\"Machinery\",\"locName\":\"Exhaust Manifold\"},{\"id\":128672307,\"name\":\"GeologicalEquipment\",\"legality\":\"\",\"buyPrice\":1539,\"sellPrice\":1486,\"meanPrice\":1665,\"demandBracket\":0,\"stockBracket\":2,\"stock\":339769,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Machinery\",\"locName\":\"Geological Equipment\"},{\"id\":128673860,\"name\":\"HNShockMount\",\"legality\":\"\",\"buyPrice\":1608,\"sellPrice\":1553,\"meanPrice\":1584,\"demandBracket\":0,\"stockBracket\":2,\"stock\":54548,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Machinery\",\"locName\":\"HN Shock Mount\"},{\"id\":128049223,\"name\":\"MarineSupplies\",\"legality\":\"\",\"buyPrice\":4167,\"sellPrice\":4080,\"meanPrice\":3916,\"demandBracket\":0,\"stockBracket\":1,\"stock\":195344,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Machinery\",\"locName\":\"Marine Equipment\"},{\"id\":128049221,\"name\":\"MineralExtractors\",\"legality\":\"\",\"buyPrice\":497,\"sellPrice\":471,\"meanPrice\":444,\"demandBracket\":0,\"stockBracket\":1,\"stock\":95896,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Machinery\",\"locName\":\"Mineral Extractors\"},{\"id\":128049217,\"name\":\"PowerGenerators\",\"legality\":\"\",\"buyPrice\":428,\"sellPrice\":405,\"meanPrice\":459,\"demandBracket\":0,\"stockBracket\":2,\"stock\":299727,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Machinery\",\"locName\":\"Power Generators\"},{\"id\":128672313,\"name\":\"SkimerComponents\",\"legality\":\"\",\"buyPrice\":750,\"sellPrice\":724,\"meanPrice\":870,\"demandBracket\":0,\"stockBracket\":2,\"stock\":7552,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Machinery\",\"locName\":\"Skimmer Components\"},{\"id\":128672308,\"name\":\"ThermalCoolingUnits\",\"legality\":\"\",\"buyPrice\":162,\"sellPrice\":150,\"meanPrice\":260,\"demandBracket\":0,\"stockBracket\":2,\"stock\":33524,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Machinery\",\"locName\":\"Thermal Cooling Units\"},{\"id\":128049218,\"name\":\"WaterPurifiers\",\"legality\":\"\",\"buyPrice\":198,\"sellPrice\":182,\"meanPrice\":259,\"demandBracket\":0,\"stockBracket\":1,\"stock\":18772,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Machinery\",\"locName\":\"Water Purifiers\"},{\"id\":128682046,\"name\":\"AdvancedMedicines\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":1470,\"meanPrice\":1258,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":54458,\"statusFlags\":[],\"categoryname\":\"Medicines\",\"locName\":\"Advanced Medicines\"},{\"id\":128049210,\"name\":\"BasicMedicines\",\"legality\":\"\",\"buyPrice\":215,\"sellPrice\":199,\"meanPrice\":280,\"demandBracket\":0,\"stockBracket\":1,\"stock\":12017,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Medicines\",\"locName\":\"Basic Medicines\"},{\"id\":128049209,\"name\":\"PerformanceEnhancers\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":7491,\"meanPrice\":6811,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":22172,\"statusFlags\":[],\"categoryname\":\"Medicines\",\"locName\":\"Performance Enhancers\"},{\"id\":128049669,\"name\":\"ProgenitorCells\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":7467,\"meanPrice\":6772,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":33114,\"statusFlags\":[],\"categoryname\":\"Medicines\",\"locName\":\"Progenitor Cells\"},{\"id\":128049176,\"name\":\"Aluminium\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":428,\"meanPrice\":340,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":1316175,\"statusFlags\":[],\"categoryname\":\"Metals\",\"locName\":\"Aluminium\"},{\"id\":128049168,\"name\":\"Beryllium\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":8983,\"meanPrice\":8290,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":120620,\"statusFlags\":[],\"categoryname\":\"Metals\",\"locName\":\"Beryllium\"},{\"id\":128049162,\"name\":\"Cobalt\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":926,\"meanPrice\":648,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":304327,\"statusFlags\":[],\"categoryname\":\"Metals\",\"locName\":\"Cobalt\"},{\"id\":128049175,\"name\":\"Copper\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":629,\"meanPrice\":481,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":2395308,\"statusFlags\":[],\"categoryname\":\"Metals\",\"locName\":\"Copper\"},{\"id\":128049170,\"name\":\"Gallium\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":5800,\"meanPrice\":5138,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":1042990,\"statusFlags\":[],\"categoryname\":\"Metals\",\"locName\":\"Gallium\"},{\"id\":128049154,\"name\":\"Gold\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":10169,\"meanPrice\":9401,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":438246,\"statusFlags\":[],\"categoryname\":\"Metals\",\"locName\":\"Gold\"},{\"id\":128049169,\"name\":\"Indium\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":6547,\"meanPrice\":5732,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":153230,\"statusFlags\":[],\"categoryname\":\"Metals\",\"locName\":\"Indium\"},{\"id\":128049173,\"name\":\"Lithium\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":1944,\"meanPrice\":1598,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":875045,\"statusFlags\":[],\"categoryname\":\"Metals\",\"locName\":\"Lithium\"},{\"id\":128671118,\"name\":\"Osmium\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":9044,\"meanPrice\":9136,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":488374,\"statusFlags\":[],\"categoryname\":\"Metals\",\"locName\":\"Osmium\"},{\"id\":128049153,\"name\":\"Palladium\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":13957,\"meanPrice\":13295,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":339546,\"statusFlags\":[],\"categoryname\":\"Metals\",\"locName\":\"Palladium\"},{\"id\":128049152,\"name\":\"Platinum\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":19714,\"meanPrice\":19756,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":25371,\"statusFlags\":[],\"categoryname\":\"Metals\",\"locName\":\"Platinum\"},{\"id\":128673845,\"name\":\"Praseodymium\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":8411,\"meanPrice\":8604,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":255815,\"statusFlags\":[],\"categoryname\":\"Metals\",\"locName\":\"Praseodymium\"},{\"id\":128673847,\"name\":\"Samarium\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":7903,\"meanPrice\":8090,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":270615,\"statusFlags\":[],\"categoryname\":\"Metals\",\"locName\":\"Samarium\"},{\"id\":128049155,\"name\":\"Silver\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":5454,\"meanPrice\":4777,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":106214,\"statusFlags\":[],\"categoryname\":\"Metals\",\"locName\":\"Silver\"},{\"id\":128049171,\"name\":\"Tantalum\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":4540,\"meanPrice\":3965,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":1281759,\"statusFlags\":[],\"categoryname\":\"Metals\",\"locName\":\"Tantalum\"},{\"id\":128049174,\"name\":\"Titanium\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":1291,\"meanPrice\":1007,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":455491,\"statusFlags\":[],\"categoryname\":\"Metals\",\"locName\":\"Titanium\"},{\"id\":128049172,\"name\":\"Uranium\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":3132,\"meanPrice\":2707,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":1744640,\"statusFlags\":[],\"categoryname\":\"Metals\",\"locName\":\"Uranium\"},{\"id\":128673848,\"name\":\"LowTemperatureDiamond\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":57674,\"meanPrice\":57443,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":12686,\"statusFlags\":[],\"categoryname\":\"Minerals\",\"locName\":\"Low Temperature Diamonds\"},{\"id\":128668550,\"name\":\"Painite\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":45059,\"meanPrice\":40504,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":3172,\"statusFlags\":[],\"categoryname\":\"Minerals\",\"locName\":\"Painite\"},{\"id\":128049214,\"name\":\"Beer\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":149,\"meanPrice\":187,\"demandBracket\":2,\"stockBracket\":0,\"stock\":0,\"demand\":184052,\"statusFlags\":[],\"categoryname\":\"Narcotics\",\"locName\":\"Beer\"},{\"id\":128672306,\"name\":\"BootlegLiquor\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":283,\"meanPrice\":852,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":3144,\"statusFlags\":[],\"categoryname\":\"Narcotics\",\"locName\":\"Bootleg Liquor\"},{\"id\":128049216,\"name\":\"Liquor\",\"legality\":\"\",\"buyPrice\":540,\"sellPrice\":512,\"meanPrice\":589,\"demandBracket\":0,\"stockBracket\":1,\"stock\":244,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Narcotics\",\"locName\":\"Liquor\"},{\"id\":128049215,\"name\":\"Wine\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":246,\"meanPrice\":261,\"demandBracket\":2,\"stockBracket\":0,\"stock\":0,\"demand\":136661,\"statusFlags\":[],\"categoryname\":\"Narcotics\",\"locName\":\"Wine\"},{\"id\":128066403,\"name\":\"Drones\",\"legality\":\"\",\"buyPrice\":101,\"sellPrice\":100,\"meanPrice\":101,\"demandBracket\":0,\"stockBracket\":3,\"stock\":122639,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"NonMarketable\"},{\"id\":128049228,\"name\":\"AutoFabricators\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":4274,\"meanPrice\":3732,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":86211,\"statusFlags\":[],\"categoryname\":\"Technology\",\"locName\":\"Auto-Fabricators\"},{\"id\":128049225,\"name\":\"ComputerComponents\",\"legality\":\"\",\"buyPrice\":441,\"sellPrice\":418,\"meanPrice\":514,\"demandBracket\":0,\"stockBracket\":1,\"stock\":3553,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Technology\",\"locName\":\"Computer Components\"},{\"id\":128049226,\"name\":\"HazardousEnvironmentSuits\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":325,\"meanPrice\":338,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":862648,\"statusFlags\":[],\"categoryname\":\"Technology\",\"locName\":\"H.E. Suits\"},{\"id\":128673873,\"name\":\"MicroControllers\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":6170,\"meanPrice\":5556,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":30232,\"statusFlags\":[],\"categoryname\":\"Technology\",\"locName\":\"Micro Controllers\"},{\"id\":128049227,\"name\":\"Robotics\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":2182,\"meanPrice\":1854,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":221255,\"statusFlags\":[],\"categoryname\":\"Technology\",\"locName\":\"Robotics\"},{\"id\":128682044,\"name\":\"ConductiveFabrics\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":672,\"meanPrice\":507,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":487752,\"statusFlags\":[],\"categoryname\":\"Textiles\",\"locName\":\"Conductive Fabrics\"},{\"id\":128049190,\"name\":\"Leather\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":292,\"meanPrice\":205,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":2236839,\"statusFlags\":[],\"categoryname\":\"Textiles\",\"locName\":\"Leather\"},{\"id\":128049191,\"name\":\"NaturalFabrics\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":491,\"meanPrice\":439,\"demandBracket\":2,\"stockBracket\":0,\"stock\":0,\"demand\":616051,\"statusFlags\":[],\"categoryname\":\"Textiles\",\"locName\":\"Natural Fabrics\"},{\"id\":128049193,\"name\":\"SyntheticFabrics\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":193,\"meanPrice\":211,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":1382163,\"statusFlags\":[],\"categoryname\":\"Textiles\",\"locName\":\"Synthetic Fabrics\"},{\"id\":128049244,\"name\":\"Biowaste\",\"legality\":\"\",\"buyPrice\":13,\"sellPrice\":10,\"meanPrice\":63,\"demandBracket\":0,\"stockBracket\":1,\"stock\":6849,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Waste \",\"locName\":\"Biowaste\"},{\"id\":128049248,\"name\":\"Scrap\",\"legality\":\"\",\"buyPrice\":27,\"sellPrice\":23,\"meanPrice\":49,\"demandBracket\":0,\"stockBracket\":2,\"stock\":132615,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Waste \",\"locName\":\"Scrap\"},{\"id\":128049236,\"name\":\"NonLethalWeapons\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":2120,\"meanPrice\":1834,\"demandBracket\":2,\"stockBracket\":0,\"stock\":0,\"demand\":2524,\"statusFlags\":[],\"categoryname\":\"Weapons\",\"locName\":\"Non-Lethal Weapons\"},{\"id\":128049233,\"name\":\"PersonalWeapons\",\"legality\":\"\",\"buyPrice\":4168,\"sellPrice\":4080,\"meanPrice\":4624,\"demandBracket\":0,\"stockBracket\":1,\"stock\":274,\"demand\":1,\"statusFlags\":[],\"categoryname\":\"Weapons\",\"locName\":\"Personal Weapons\"},{\"id\":128049235,\"name\":\"ReactiveArmour\",\"legality\":\"\",\"buyPrice\":0,\"sellPrice\":2475,\"meanPrice\":2108,\"demandBracket\":3,\"stockBracket\":0,\"stock\":0,\"demand\":8225,\"statusFlags\":[],\"categoryname\":\"Weapons\",\"locName\":\"Reactive Armour\"}]}";



            CMarket market = new CMarket();

            JObject jo = JObject.Parse(resp);

            Assert.NotNull(jo, "Json parse");
            bool ret = market.FromJson(jo);

            Assert.IsTrue(ret, "From JSon");

            Assert.AreEqual(3230605824, market.id, "id");

            Assert.AreEqual("Dunbar Ring", market.name, "Name");

            Assert.AreEqual(79, market.commodities.Count, "nr Commodities");


            Assert.AreEqual("hydrogenfuel", market.commodities[0].fdname, "Name");
            Assert.AreEqual(113, market.commodities[0].buyPrice, "buyPrice");
            Assert.AreEqual(108, market.commodities[0].sellPrice, "sellPrice");
            Assert.AreEqual(110, market.commodities[0].meanPrice, "meanPrice");
            Assert.AreEqual(0, market.commodities[0].demandBracket, "demandBracket");
            Assert.AreEqual(1, market.commodities[0].stockBracket, "stockBracket");
            Assert.AreEqual(150631, market.commodities[0].stock, "stock");
            Assert.AreEqual(1, market.commodities[0].demand, "demand");
            Assert.AreEqual("$MARKET_category_chemicals", market.commodities[0].category, "categoryname");
            Assert.AreEqual("Hydrogen Fuel", market.commodities[0].locName, "locName");
        }
Ejemplo n.º 2
0
        public CMarket GetMarket()
        {
            if (NeedLogin == true)
            {
                throw new CompanionAppIllegalStateException("Service is not logged in to profile");
            }

            if (!Credentials.Confirmed)
            {
                throw new CompanionAppIllegalStateException("Credentials are not confirmed");
            }

            string data = DownloadMarket();

            if (data == null || data == "Profile unavailable")
            {
                // Happens if there is a problem with the API.  Logging in again might clear this...
                Credentials.appId = null;
                relogin();
                data = DownloadMarket();

                if (data == null || data == "Profile unavailable")
                {
                    // Try logging in again without clearing the session ID
                    relogin();
                    data = DownloadMarket();

                    if (data == null || data == "Profile unavailable")      // uhoh
                    {
                        Logout();
                        throw new CompanionAppException("Failed to obtain data from Frontier server");
                    }
                }
            }

            ProfileString = data;
            JObject jo = JObject.Parse(ProfileString);

            ProfileString = jo.ToString(Formatting.Indented);       // nicer
            //System.Diagnostics.Debug.WriteLine(ProfileString);
            CMarket market = new CMarket();

            if (market.FromJson(jo))
            {
                return(market);
            }
            else
            {
                return(null);
            }
        }