Example #1
0
 public StudentOffice(IStockBehaviour stock)
 {
     _clientlist       = new Dictionary <Client, decimal>();
     _transactionsList = new List <Transaction>();
     _stock            = stock;
     _commercial       = new Commercial();
 }
Example #2
0
        public void TestSubstractingProduct()
        {
            Order           waterOrder = new Order(sut.GetProductByName("water"), 5);
            IStockBehaviour publisher  = (IStockBehaviour)sut;

            publisher.SellingOperations(john.GetAppropriatePrice(waterOrder._product), waterOrder);

            Assert.Equal(45, sut.StockProduct[waterOrder._product]);
        }
Example #3
0
        public void OrderingIntoStockTest()
        {
            IStockBehaviour stock      = office.Stock;
            Commercial      commercial = office._commercial;

            stock.AddToStock(commercial.OrderedProduct("chips", 5));
            IStockData stockData = (IStockData)stock;

            Assert.Equal(55, stockData.GetProductQuantity("chips"));
        }
 internal StudentOfficeBuilder()
 {
     office          = new StudentOffice(new Stock(1000m, new OrderingRepository()));
     commercial      = office._commercial;
     stock           = office.Stock;
     products        = new ProductGenerator(commercial);
     mealPlanBuilder = new MealPlanDirector();
     InitializeStock();
     office.AddClient(john, 50); office.AddClient(jane, 50);
     stock.Attach(office);
 }
Example #5
0
 public void RestoreState(IMemento memento)
 {
     this.ClientList       = memento.GetClientsSnapshot();
     this._stock           = (IStockBehaviour)memento.GetStockSnapshot();
     this.TransactionsList = memento.GetTransactionsSnapshot();
 }