public void BestSingleTripLimitedByAvailability() { /* the best route in which money and cargo space are no object is: * 83 Kernite from Line 2 station 1 (sec 0.8) to Line 3B station 1 (sec 0.7) */ parameters = new Parameters(10000000.0f, 10000000.0f, null, TripType.SingleTrip); finder = new TradeFinder(map, market, parameters); finder.SortByProfitPerWarp(true); Assert.Greater(finder.SingleTrips.Count, 0); SingleTrip best = finder.SingleTrips[0]; Assert.AreSame(map.GetStation(12), best.Source); Assert.AreSame(map.GetStation(12), best.Destination); TransactionList tl = best.GetPurchases(); Assert.AreSame(database.GetItemType("Navitas"), tl[0].Purchases[0].Type); Assert.AreEqual(0, best.Jumps(true)); Assert.AreEqual(0, best.Warps(true)); Assert.AreEqual(SecurityStatus.Level.HighSec, best.Security); Assert.AreEqual(7487, best.Quantity); // 7487 Kernite wanted at 32 float buyFor = 7487.0f * 344.45f; float sellFor = 7487.0f * 352.62f; Assert.AreEqual(buyFor, best.Cost); Assert.AreEqual(sellFor - buyFor, best.Profit); Assert.AreEqual((sellFor - buyFor) / 1.0f, best.ProfitPerWarp(true)); }
public void BestSingleTripLimitedByIsk() { /* the best route in which money is the limiting factor is: * 83 Kernite from Line 2 station 1 (sec 0.8) to Line 3B station 1 (sec 0.7) */ parameters = new Parameters(1000.0f, 10000000.0f, null, TripType.SingleTrip); finder = new TradeFinder(map, market, parameters); finder.SortByProfitPerWarp(true); Assert.Greater(finder.SingleTrips.Count, 0); SingleTrip best = finder.SingleTrips[0]; Assert.AreSame(map.GetStation(21), best.Source); Assert.AreSame(map.GetStation(41), best.Destination); TransactionList tl = best.GetPurchases(); Assert.AreSame(database.GetItemType("Kernite"), tl[0].Purchases[0].Type); Assert.AreEqual(1, best.Jumps(true)); Assert.AreEqual(3, best.Warps(true)); Assert.AreEqual(0.7f, best.Security); Assert.AreEqual(3, best.Quantity); // can only affort 3 Kernite float buyFor = 3.0f * 305.52f; float sellFor = 3.0f * 352.9f; Assert.AreEqual(buyFor, best.Cost); Assert.AreEqual(sellFor - buyFor - (sellFor * 0.01f), best.Profit); Assert.AreEqual((sellFor - buyFor - (sellFor * 0.01f)) / 3.0f, best.ProfitPerWarp(true)); }
public void BestSingleTripLimitedByCargo() { /* the best route where money is no object but cargo space is, is: * 83 Kernite from Line 2 station 1 (sec 0.8) to Line 3B station 1 (sec 0.7) */ parameters = new Parameters(10000000.0f, 100.0f, null, TripType.SingleTrip); finder = new TradeFinder(map, market, parameters); finder.SortByProfitPerWarp(true); Assert.Greater(finder.SingleTrips.Count, 0); SingleTrip best = finder.SingleTrips[0]; Assert.AreSame(map.GetStation(31), best.Source); Assert.AreSame(map.GetStation(32), best.Destination); TransactionList tl = best.GetPurchases(); Assert.AreSame(database.GetItemType("Kernite"), tl[0].Purchases[0].Type); Assert.AreEqual(0, best.Jumps(true)); Assert.AreEqual(1, best.Warps(true)); Assert.AreEqual(SecurityStatus.Level.HighSec, best.Security); Assert.AreEqual(83, best.Quantity); // Kernite is 1.2 vol, so we can only fit 83 in our hold float buyFor = 83.0f * 344.45f; float sellFor = 83.0f * 352.62f; Assert.AreEqual(buyFor, best.Cost); Assert.AreEqual(sellFor - buyFor - (sellFor * 0.01f), best.Profit); Assert.AreEqual((sellFor - buyFor - (sellFor * 0.01f)) / 1.0f, best.ProfitPerWarp(true)); }
public void TestFixtureSetUp() { Parameters param = new Parameters(10.0f, 10.0f, "none", TripType.SingleTrip, 0); ItemDatabase database = TestObjectFactory.CreateItemDatabase(); map = TestObjectFactory.CreateMap(); trip = new SingleTrip(map, map.GetStation(11), map.GetStation(31)); trip.AddPurchase(new Transaction(new Trade(database.GetItemType("Navitas"), 1000.0f, 3), new Trade(database.GetItemType("Navitas"), 1100.0f, 3))); empty = new SingleTrip(map, map.GetStation(11), map.GetStation(52)); }
public void TestFixtureSetUp() { Parameters param = new Parameters(10.0f, 10.0f, "none", TripType.SingleTrip, 0); ItemDatabase database = TestObjectFactory.CreateItemDatabase(); map = TestObjectFactory.CreateMap(); trip = new SingleTrip(map, map.GetStation(11), map.GetStation(31)); trip.AddPurchase(new Transaction(new Trade(database.GetItemType("Navitas"), 1000.0f, 3), new Trade(database.GetItemType("Navitas"), 1100.0f, 3))); empty = new SingleTrip(map, map.GetStation(11), map.GetStation(52)); }
public void SortByProfitPerWarpFromHere() { parameters = new Parameters(10000000.0f, 10000000.0f, "HighSec1", TripType.SingleTrip); finder = new TradeFinder(map, market, parameters); finder.SortByProfitPerWarpFromStartingSystem(true); Assert.Greater(finder.SingleTrips.Count, 3); SingleTrip one = finder.SingleTrips[1]; SingleTrip two = finder.SingleTrips[2]; Assert.Greater(one.ProfitPerWarpFromStartingSystem(true), two.ProfitPerWarpFromStartingSystem(true)); Assert.Less(one.ProfitPerWarp(true), two.ProfitPerWarp(true)); }
public void TestFixtureSetUp() { Parameters param = new Parameters(10.0f, 10.0f, "none", TripType.SingleTrip, 0); ItemDatabase database = TestObjectFactory.CreateItemDatabase(); Map map = TestObjectFactory.CreateMap(); SingleTrip there = new SingleTrip(map, map.GetStation(31), map.GetStation(11)); there.AddPurchase(new Transaction(new Trade(database.GetItemType("Navitas"), 1000.0f, 1), new Trade(database.GetItemType("Navitas"), 1100.0f, 1))); SingleTrip backAgain = new SingleTrip(map, map.GetStation(11), map.GetStation(31)); backAgain.AddPurchase(new Transaction(new Trade(database.GetItemType("Kernite"), 300.0f, 50), new Trade(database.GetItemType("Kernite"), 310.0f, 50))); trip = new RoundTrip(there, backAgain); SingleTrip backWithNothing = new SingleTrip(map, map.GetStation(31), map.GetStation(41)); badTrip = new RoundTrip(there, backWithNothing); }
public void TestFixtureSetUp() { Parameters param = new Parameters(10.0f, 10.0f, "none", TripType.SingleTrip, 0); ItemDatabase database = TestObjectFactory.CreateItemDatabase(); Map map = TestObjectFactory.CreateMap(); SingleTrip there = new SingleTrip(map, map.GetStation(31), map.GetStation(11)); there.AddPurchase(new Transaction(new Trade(database.GetItemType("Navitas"), 1000.0f, 1), new Trade(database.GetItemType("Navitas"), 1100.0f, 1))); SingleTrip backAgain = new SingleTrip(map, map.GetStation(11), map.GetStation(31)); backAgain.AddPurchase(new Transaction(new Trade(database.GetItemType("Kernite"), 300.0f, 50), new Trade(database.GetItemType("Kernite"), 310.0f, 50))); trip = new RoundTrip(there, backAgain); SingleTrip backWithNothing = new SingleTrip(map, map.GetStation(31), map.GetStation(41)); badTrip = new RoundTrip(there, backWithNothing); }