Esempio n. 1
0
        public void GetTransactionsForUser_ReturnsCorrectTransactions_True()
        {
            IBarcodeSystem barcodeSystem = Substitute.For <IBarcodeSystem>();
            User           user          = Substitute.For <User>(userArgs);
            Product        product       = Substitute.For <Product>(productArgs);

            user.Balance = 1000m;
            const int amountOfPurchases = 5;

            for (int i = 0; i < amountOfPurchases; i++)
            {
                barcodeSystem.BuyProduct(user, product);
            }
            IEnumerable <Transaction> transactionsForUser =
                barcodeSystem.GetTransactionsForUser(user, amountOfPurchases);

            Assert.That(transactionsForUser, Is.All.Property("User").EqualTo(user));
        }
Esempio n. 2
0
 public ProductSetActiveState(string[] command, bool isActive, IBarcodeCLI barcodeCli,
                              IBarcodeSystem barcodeSystem) : base(command, barcodeCli, barcodeSystem)
 {
     active = isActive;
 }
Esempio n. 3
0
 public ProductSetCreditState(string[] command, bool canBeBoughtOnCredit, IBarcodeCLI barcodeCli,
                              IBarcodeSystem barcodeSystem) : base(command, barcodeCli, barcodeSystem)
 {
     credit = canBeBoughtOnCredit;
 }
Esempio n. 4
0
 public AddCreditToUser(string[] command, IBarcodeCLI barcodeCli, IBarcodeSystem barcodeSystem) : base(command)
 {
     this.barcodeCli    = barcodeCli;
     this.barcodeSystem = barcodeSystem;
 }
Esempio n. 5
0
 public DisplayAllProductsCommand(string[] command, IBarcodeCLI barcodeCli, IBarcodeSystem barcodeSystem)
     : base(command)
 {
     this.barcodeCli    = barcodeCli;
     this.barcodeSystem = barcodeSystem;
 }
Esempio n. 6
0
 protected ProductSetCommand(string[] command, IBarcodeCLI barcodeCli, IBarcodeSystem barcodeSystem) :
     base(command)
 {
     this.barcodeCli    = barcodeCli;
     this.barcodeSystem = barcodeSystem;
 }
Esempio n. 7
0
 public DisplayUserInfoCommand(string[] command, IBarcodeCLI barcodeCli, IBarcodeSystem barcodeSystem) :
     base(command)
 {
     this.barcodeCli    = barcodeCli;
     this.barcodeSystem = barcodeSystem;
 }
Esempio n. 8
0
 public BuyProductCommand(string[] command, IBarcodeCLI barcodeCli, IBarcodeSystem barcodeSystem) : base(command)
 {
     this.barcodeCli    = barcodeCli;
     this.barcodeSystem = barcodeSystem;
 }