public void StockConsolidation() { var mockRepository = new MockRepository(MockBehavior.Strict); var stock = new Stock(Guid.NewGuid()); stock.List("ABC", "ABC Pty Ltd", new Date(1974, 01, 01), false, AssetCategory.AustralianStocks); stock.ChangeDividendRules(new Date(1974, 01, 01), 0.30m, RoundingRule.Round, false, DrpMethod.Round); var stockResolver = mockRepository.Create <IStockResolver>(); stockResolver.Setup(x => x.GetStock(stock.Id)).Returns(stock); var splitConsolidation = new SplitConsolidation(Guid.NewGuid(), stock, new Date(2020, 01, 01), "Test SplitConsolidation", 2, 1); var holding = mockRepository.Create <IReadOnlyHolding>(); holding.Setup(x => x.Properties[splitConsolidation.Date]).Returns(new HoldingProperties(100, 1000.00m, 1000.00m)); holding.Setup(x => x.Settings).Returns(new HoldingSettings(false)); var result = splitConsolidation.GetTransactionList(holding.Object, stockResolver.Object).ToList(); result.Should().SatisfyRespectively( first => { first.Should().BeOfType <UnitCountAdjustment>(); if (first is UnitCountAdjustment unitCountAdjustment) { unitCountAdjustment.Date.Should().Be(splitConsolidation.Date); unitCountAdjustment.Stock.Should().Be(splitConsolidation.Stock); unitCountAdjustment.Comment.Should().Be("Test SplitConsolidation"); unitCountAdjustment.NewUnits.Should().Be(1); unitCountAdjustment.OriginalUnits.Should().Be(2); } } ); mockRepository.Verify(); }
public void NoParcelsAtRecordDate() { var mockRepository = new MockRepository(MockBehavior.Strict); var stock = new Stock(Guid.NewGuid()); stock.List("ABC", "ABC Pty Ltd", new Date(1974, 01, 01), false, AssetCategory.AustralianStocks); var stockResolver = mockRepository.Create <IStockResolver>(); stockResolver.Setup(x => x.GetStock(stock.Id)).Returns(stock); var splitConsolidation = new SplitConsolidation(Guid.NewGuid(), stock, new Date(2020, 01, 01), "Test SplitConsolidation", 1, 2); var holding = mockRepository.Create <IReadOnlyHolding>(); holding.Setup(x => x.Properties[splitConsolidation.Date]).Returns(new HoldingProperties(0, 0.00m, 0.00m)); var result = splitConsolidation.GetTransactionList(holding.Object, stockResolver.Object).ToList(); result.Should().BeEmpty(); mockRepository.Verify(); }