public void ShouldThrowExcepIfSellerDontHasNShares()
        {
            var portfolioTableRepository = Substitute.For <IPortfolioTableRepository>();
            PortfolioServices portfolio  = new PortfolioServices(portfolioTableRepository);
            var user = new UserEntity()
            {
                UsersShares = new List <PortfolioEntity>()
                {
                    new PortfolioEntity()
                    {
                        ShareId = 1,
                        Amount  = 1
                    }
                }
            };

            portfolio.ChangeAmountOfShares(user.UsersShares.Where(us => us.ShareId == 1).First(), -10);
        }
        public void ShouldChangeAmountOfShareByUser()
        {
            var portfolioTableRepository = Substitute.For <IPortfolioTableRepository>();
            PortfolioServices portfolio  = new PortfolioServices(portfolioTableRepository);
            PortfolioEntity   args       = new PortfolioEntity()
            {
                UserEntityId = 1,
                ShareId      = 1,
                Amount       = 50
            };

            portfolio.ChangeAmountOfShares(args, -10);

            portfolioTableRepository.Contains(Arg.Is <PortfolioEntity>(
                                                  u => u.UserEntityId == args.UserEntityId &&
                                                  u.ShareId == args.ShareId &&
                                                  u.Amount == args.Amount - 10)).Returns(true);
            portfolioTableRepository.Received(1).SaveChanges();
        }