public void ShouldCreateEmptyOperation()
        {
            // Arrange
            SalesService salesService = new SalesService(
                this.operationTableRepository,
                this.balanceTableRepository,
                this.blockedMoneyTableRepository,
                this.sharesNumberTableRepository,
                this.blockedSharesNumberTableRepository);

            // Act
            var operation = salesService.CreateOperation();

            // Assert
            this.operationTableRepository.Received(1).Add(Arg.Is <OperationEntity>(
                                                              o => o.Id == operation.Id &&
                                                              o.Customer == null &&
                                                              o.Seller == null &&
                                                              o.Share == null &&
                                                              o.ShareTypeName == null &&
                                                              o.Cost == 1 &&
                                                              o.Number == 1 &&
                                                              o.Total == 1));
            this.operationTableRepository.Received(1).SaveChanges();
        }
Beispiel #2
0
        public void Start()
        {
            Console.WriteLine("Please wait while the database is loading...");
            salesService.RemoveOperation(salesService.CreateOperation());

            /* ---The Traiding App---
             *
             * Traiding Live!
             * Time until the next deal: ...[10] // countdown to next deal from 10 to 1, Now
             * Last deal: [] // last operation from dto.Operations
             *
             * Enter 'm' for switch to Menu or 'e' for Exit.
             */

            /* ---The Traiding App---
             * Traiding is running.
             *
             * Menu
             *  1. Add a new client
             *  2. Clients in 'Orange' zone // client with zero balances
             *  3. Add a new share into system
             *  4. Add a new share type into system
             *  5. Change the cost of share type
             *  6. View Deal History
             *  7. Change share type for share
             *
             * Enter the number for action or 't' for switch to 'Traiding Live!' or 'e' for Exit.
             */

            Thread traidingLive = new Thread(traiding);

            traidingLive.Start();

            string inputString;

            do
            {
                Console.Clear();

                Console.WriteLine("---The Traiding App---");
                Console.WriteLine("Traiding is running.");
                Console.WriteLine(String.Empty);
                Console.WriteLine("Menu");
                Console.WriteLine(" 1. Add a new client");
                Console.WriteLine(" 2. Clients in 'Orange' zone");
                //Console.WriteLine(" 6. View Deal History");
                Console.WriteLine(String.Empty);
                Console.Write("Type the number or 'e' for exit and press Enter: ");

                inputString = Console.ReadLine();
                switch (inputString)
                {
                case "1":
                    Console.WriteLine("  Client registration service.");     // signal about enter into case
                    AddClient();
                    // ioProvider.ReadLine(); // pause
                    break;

                case "2":
                    Console.WriteLine("  Clients in 'Orange' zone — clients with zero balances");     // signal about enter into case
                    viewClientsWithZeroBalances();
                    break;

                //case "6":
                //    Console.WriteLine("  Deal history (Last 10)."); // signal about enter into case
                //    viewDealHistory();
                //    break;
                default:
                    break;
                }
            } while (inputString != "e");

            //Console.ReadKey();
            traidingLive.Abort();
        }