public void FifoTest120SharesSold() { var transaction = new Transaction { SharesSold = 120, PricePerShare = 10.5m, Selldate = new DateTime(2005, 4, 3) }; var fifo = new Fifo(); var assets = Assets; var costPrice = fifo.CostPriceOfSharesSoldAndSharesRemaining(transaction, assets); Assert.AreEqual(1240.0m / 120.0m, costPrice.CostPriceSold); }
public void FifoTestOneAssetSellMoreSharesThanOwn() { var transaction = new Transaction { SharesSold = 120, PricePerShare = 10.5m, Selldate = new DateTime(2005, 2, 3) }; var fifo = new Fifo(); var assets = Assets.Take(1).ToList(); Action action = () => fifo.CostPriceOfSharesSoldAndSharesRemaining(transaction, assets); Assert.ThrowsException <ArgumentOutOfRangeException>(action); }
public void FifoTest140SharesSoldTwoAssets() { var transaction = new Transaction { SharesSold = 140, PricePerShare = 10.5m, Selldate = new DateTime(2005, 2, 3) }; var fifo = new Fifo(); var assets = Assets.Take(2).ToList();; var costPrice = fifo.CostPriceOfSharesSoldAndSharesRemaining(transaction, assets); Assert.AreEqual(1480.0m / 140.0m, costPrice.CostPriceSold); }
public void FifoTest140SharesSoldSpecifyingDateInMiddleOfTransactions() { var transaction = new Transaction { SharesSold = 100, PricePerShare = 10.5m, Selldate = new DateTime(2005, 1, 3) }; var fifo = new Fifo(); var assets = Assets; var costPrice = fifo.CostPriceOfSharesSoldAndSharesRemaining(transaction, assets); Assert.AreEqual(1000.0m / 100.0m, costPrice.CostPriceSold); }