Esempio n. 1
0
        public void TestCargoConfig()
        {
            string cargoConfigJson           = @"{
	            ""cargo"": [{
		            ""edname"": ""DamagedEscapePod"",
		            ""stolen"": 0,
		            ""haulage"": 0,
		            ""owned"": 4,
		            ""need"": 0,
		            ""total"": 4,
		            ""ejected"": 0,
		            ""price"": 11912,
		            ""haulageamounts"": []
	            },
	            {
		            ""edname"": ""USSCargoBlackBox"",
		            ""stolen"": 4,
		            ""haulage"": 0,
		            ""owned"": 0,
		            ""need"": 0,
		            ""total"": 4,
		            ""ejected"": 0,
		            ""price"": 6995,
		            ""haulageamounts"": []
	            },
	            {
		            ""edname"": ""Drones"",
		            ""stolen"": 0,
		            ""haulage"": 0,
		            ""owned"": 21,
		            ""need"": 0,
		            ""total"": 21,
		            ""ejected"": 0,
		            ""price"": 101,
		            ""haulageamounts"": []
	            }],
	            ""cargocarried"": 29
            }";
            CargoMonitorConfiguration config = CargoMonitorConfiguration.FromJsonString(cargoConfigJson);

            Assert.AreEqual(3, config.cargo.Count);
            cargo = config.cargo.ToList().FirstOrDefault(c => c.edname == "DamagedEscapePod");
            Assert.AreEqual("Damaged Escape Pod", cargo.commodityDef.invariantName);
            Assert.AreEqual(4, cargo.total);
            Assert.AreEqual(4, cargo.owned);
            Assert.AreEqual(0, cargo.need);
            Assert.AreEqual(0, cargo.stolen);
            Assert.AreEqual(0, cargo.haulage);
        }
Esempio n. 2
0
        public void TestCargoConfig()
        {
            string cargoConfigJson           = @"{
                ""cargo"": [{
                    ""edname"": ""DamagedEscapePod"",
                    ""stolen"": 0,
                    ""haulage"": 0,
                    ""owned"": 4,
                    ""need"": 0,
                    ""total"": 4,
                    ""ejected"": 0,
                    ""price"": 11912,
                    ""haulageData"": [{
                        ""missionid"": 413563829,
                        ""name"": ""Mission_Salvage_Expansion"",
                        ""typeEDName"": ""Salvage"",
                        ""status"": ""Active"",
                        ""originsystem"": ""HIP 20277"",
                        ""sourcesystem"": ""Bunuson"",
                        ""sourcebody"": null,
                        ""amount"": 4,
                        ""remaining"": 4,
                        ""startmarketid"": 0,
                        ""endmarketid"": 0,
                        ""collected"": 0,
                        ""delivered"": 0,
                        ""expiry"": null,
                        ""shared"": false
                    }]
                },
                {
                    ""edname"": ""USSCargoBlackBox"",
                    ""stolen"": 4,
                    ""haulage"": 0,
                    ""owned"": 0,
                    ""need"": 0,
                    ""total"": 4,
                    ""ejected"": 0,
                    ""price"": 6995,
                    ""haulageData"": []
                },
                {
                    ""edname"": ""Drones"",
                    ""stolen"": 0,
                    ""haulage"": 0,
                    ""owned"": 21,
                    ""need"": 0,
                    ""total"": 21,
                    ""ejected"": 0,
                    ""price"": 101,
                    ""haulageData"": []
                }],
                ""cargocarried"": 29
            }";
            CargoMonitorConfiguration config = CargoMonitorConfiguration.FromJsonString(cargoConfigJson);

            Assert.AreEqual(3, config.cargo.Count);
            cargo = config.cargo.ToList().FirstOrDefault(c => c.edname == "DamagedEscapePod");
            Assert.AreEqual("Damaged Escape Pod", cargo.commodityDef.invariantName);
            Assert.AreEqual(4, cargo.total);
            Assert.AreEqual(4, cargo.owned);
            Assert.AreEqual(0, cargo.need);
            Assert.AreEqual(0, cargo.stolen);
            Assert.AreEqual(0, cargo.haulage);
            Assert.AreEqual(11912, cargo.price);

            // Verify haulage object
            Assert.AreEqual(1, cargo.haulageData.Count());
            Haulage haulage = cargo.haulageData[0];

            Assert.AreEqual(413563829, haulage.missionid);
            Assert.AreEqual("Mission_Salvage_Expansion", haulage.name);
            Assert.AreEqual("Salvage", haulage.typeEDName);
            Assert.AreEqual(4, haulage.amount);
            Assert.AreEqual(4, haulage.remaining);
            Assert.IsFalse(haulage.shared);
        }