using XFEEDToolBox.Core.Execution;
using XFEExtension.NetCore.XUnit.Attributes;
namespace XFEEDToolBox.Test;
[TestFixture]
public class CgBatchPlannerTests
{
[Test]public void PartiallyStockedHighMarginCanBeatAFullLowerMarginHold()
{
var order=CgBatchPlanner.Select([new("uranium","Uranium",107,7241,57104),new("liquidoxygen","Liquid oxygen",10000,667,11000)],192,35000000,4427098);
Check.Equal("uranium",order.Commodity);Check.Equal(107,order.Quantity);
}
[Test]public void DepletedUraniumUsesTheActualProfitableAlternative()
{
var order=CgBatchPlanner.Select([new("uranium","Uranium",0,7241,57104),new("polymers","Polymers",10000,139,2448),new("liquidoxygen","Liquid oxygen",10000,667,11000)],192,35000000,4427098);
Check.Equal("liquidoxygen",order.Commodity);Check.Equal(192,order.Quantity);
}
[Test]public void AffordabilityPreservesReserveAndUnprofitableOrUnsupportedQuotesCannotBuy()
{
var order=CgBatchPlanner.Select([new("uranium","Uranium",999,7241,57104)],192,4427098+7241*3,4427098);
Check.Equal(3,order.Quantity);
Check.Throws<InvalidOperationException>(()=>CgBatchPlanner.Select([new("uranium","Uranium",99,60000,57104),new("gold","Gold",99,1,100000)],192,35000000,4427098));
Check.Throws<InvalidOperationException>(()=>CgBatchPlanner.Select([new("uranium","Uranium",999,7241,57104)],192,4427097,4427098));
}
}
using XFEEDToolBox.Core.Execution;
using XFEExtension.NetCore.XUnit.Attributes;
namespace XFEEDToolBox.Test;
[TestFixture]
public class CgBatchPlannerTests
{
[Test]public void PartiallyStockedHighMarginCanBeatAFullLowerMarginHold()
{
var order=CgBatchPlanner.Select([new("uranium","Uranium",107,7241,57104),new("liquidoxygen","Liquid oxygen",10000,667,11000)],192,35000000,4427098);
Check.Equal("uranium",order.Commodity);Check.Equal(107,order.Quantity);
}
[Test]public void DepletedUraniumUsesTheActualProfitableAlternative()
{
var order=CgBatchPlanner.Select([new("uranium","Uranium",0,7241,57104),new("polymers","Polymers",10000,139,2448),new("liquidoxygen","Liquid oxygen",10000,667,11000)],192,35000000,4427098);
Check.Equal("liquidoxygen",order.Commodity);Check.Equal(192,order.Quantity);
}
[Test]public void AffordabilityPreservesReserveAndUnprofitableOrUnsupportedQuotesCannotBuy()
{
var order=CgBatchPlanner.Select([new("uranium","Uranium",999,7241,57104)],192,4427098+7241*3,4427098);
Check.Equal(3,order.Quantity);
Check.Throws<InvalidOperationException>(()=>CgBatchPlanner.Select([new("uranium","Uranium",99,60000,57104),new("gold","Gold",99,1,100000)],192,35000000,4427098));
Check.Throws<InvalidOperationException>(()=>CgBatchPlanner.Select([new("uranium","Uranium",999,7241,57104)],192,4427097,4427098));
}
}