public void PortfolioNotFound()
        {
            var service = new PortfolioCorporateActionsService(null, PortfolioTestCreator.StockResolver);

            var result = service.GetCorporateActions();

            result.Should().HaveNotFoundStatus();
        }
        public void GetCorporateActionsStockNotOwned()
        {
            var portfolio = PortfolioTestCreator.CreateDefaultPortfolio();

            var service = new PortfolioCorporateActionsService(portfolio, PortfolioTestCreator.StockResolver);

            var result = service.GetCorporateActions(Guid.NewGuid());

            result.Should().HaveNotFoundStatus();
        }
        public void GetCorporateActionsForStock()
        {
            var portfolio = PortfolioTestCreator.CreateDefaultPortfolio();

            var service = new PortfolioCorporateActionsService(portfolio, PortfolioTestCreator.StockResolver);

            var result = service.GetCorporateActions(PortfolioTestCreator.Stock_WAM.Id);

            result.Result.Should().BeEquivalentTo(new
            {
                CorporateActions = new[]
                {
                    new CorporateActionsResponse.CorporateActionItem()
                    {
                        Id = PortfolioTestCreator.WAM_Split, ActionDate = new Date(2002, 01, 01), Stock = PortfolioTestCreator.Stock_WAM, Description = "WAM Split"
                    },
                }
            });
        }
        public void GetTransactionsForCorporateAction()
        {
            var portfolio = PortfolioTestCreator.CreateDefaultPortfolio();

            var service = new PortfolioCorporateActionsService(portfolio, PortfolioTestCreator.StockResolver);

            var result = service.GetTransactionsForCorporateAction(PortfolioTestCreator.Stock_WAM.Id, PortfolioTestCreator.WAM_Split);

            result.Result.Should().BeEquivalentTo(new []
            {
                new RestApi.Transactions.UnitCountAdjustment()
                {
                    Stock           = PortfolioTestCreator.Stock_WAM.Id,
                    TransactionDate = new Date(2002, 01, 01),
                    Description     = "Adjust unit count using ratio 1:2",
                    Comment         = "WAM Split",
                    OriginalUnits   = 1,
                    NewUnits        = 2
                }
            }, options => options.Excluding(x => x.Id));
        }