public void GetAllSharesTest() { // Arrange var shareRepositoryMock = Substitute.For <ISharesRepository>(); var sut = new SharesService(shareRepositoryMock); // Act sut.GetAllShares(); // Asserts shareRepositoryMock.Received(1).GetAllShares(); }
public bool Trading() { int sharesForTrade = random.Next(1, 20); Transaction transaction = new Transaction { BuyerID = random.Next(1, clientService.GetAllClients().Count()), SellerID = random.Next(1, clientService.GetAllClients().Count()), ShareID = random.Next(1, sharesService.GetAllShares().Count()), AmountOfShares = sharesForTrade, Date = DateTime.Now, }; if (validationService.ValidateTransaction(transaction, logger)) { transactionsService.SellOrBuyShares(transaction); transactionsService.AddTransaction(transaction); return(true); } return(false); }