public void ShouldNotAddNewShareIfShareTypeDoesntExist()
        {
            // Arrange
            var shareService = new ShareService(
                this.shareRepository,
                this.shareTypeRepository,
                this.stockRepository,
                this.traderRepository);
            ShareInfo shareInfo = new ShareInfo
            {
                Amount      = 2,
                StockId     = 1,
                ShareTypeId = 1,
                OwnerId     = 1
            };

            this.stockRepository.GetById(1)
            .Returns(new StockEntity {
            });
            this.traderRepository.GetById(1)
            .ReturnsNull();
            this.shareTypeRepository.GetById(1)
            .ReturnsNull();

            // Act
            shareService.AddNewShare(shareInfo);
        }
        public void ShouldAddNewShare()
        {
            // Arrange
            var shareService = new ShareService(
                this.shareRepository,
                this.shareTypeRepository,
                this.stockRepository,
                this.traderRepository);
            ShareInfo shareInfo = new ShareInfo
            {
                Amount      = 2,
                StockId     = 1,
                ShareTypeId = 1,
                OwnerId     = 1
            };

            this.shareTypeRepository.GetById(1)
            .Returns(new ShareTypeEntity {
            });
            this.stockRepository.GetById(1)
            .Returns(new StockEntity {
            });
            this.traderRepository.GetById(1)
            .Returns(new TraderEntity {
            });

            // Act
            shareService.AddNewShare(shareInfo);
            // Assert
            this.shareRepository.Received(1).Add(Arg.Any <ShareEntity>());
            this.shareRepository.Received(1).SaveChanges();
        }