Ejemplo n.º 1
0
        public void Initialize()
        {
            this.clientTableRepository             = Substitute.For <IClientTableRepository>();
            this.stockTableRepository              = Substitute.For <IStockTableRepository>();
            this.stockOfClientsTableRepository     = Substitute.For <IStockOfClientsTableRepository>();
            this.transactionHistoryTableRepository = Substitute.For <ITransactionHistoryTableRepository>();
            this.editClientStockService            = new EditCleintStockService(this.stockOfClientsTableRepository);


            clientTableRepository.Get(5).Returns(new ClientEntity()
            {
                ID             = 5,
                Name           = "Serj",
                Surname        = "Tankian",
                PhoneNumber    = "+7228133705",
                AccountBalance = 100,
            });
            clientTableRepository.Get(32).Returns(new ClientEntity()
            {
                ID             = 32,
                Name           = "Chester",
                Surname        = "Bennington",
                PhoneNumber    = "+7228133705",
                AccountBalance = 50
            });

            stockTableRepository.Get(1).Returns(new StockEntity()
            {
                ID   = 1,
                Name = "Yandex",
                Type = "P",
                Cost = 10
            });

            stockOfClientsTableRepository.Get(2).Returns(new StockOfClientsEntity()
            {
                ID       = 2,
                ClientID = 32,
                StockID  = 1,
                Amount   = 5
            });

            stockTableRepository.GetCost(Arg.Is <int>(1)).Returns(10);
            stockOfClientsTableRepository.GetAmount(Arg.Is <int>(5),
                                                    Arg.Is <int>(1)).Returns(0);
            stockOfClientsTableRepository.GetAmount(Arg.Is <int>(32),
                                                    Arg.Is <int>(1)).Returns(10);
            clientTableRepository.GetBalance(Arg.Is <int>(5)).Returns(100);
            clientTableRepository.GetBalance(Arg.Is <int>(32)).Returns(50);
            stockTableRepository.GetType(Arg.Is <int>(1)).Returns("P");
        }