예제 #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));
        }
예제 #2
0
 public ProductSetActiveState(string[] command, bool isActive, IBarcodeCLI barcodeCli,
                              IBarcodeSystem barcodeSystem) : base(command, barcodeCli, barcodeSystem)
 {
     active = isActive;
 }
예제 #3
0
 public ProductSetCreditState(string[] command, bool canBeBoughtOnCredit, IBarcodeCLI barcodeCli,
                              IBarcodeSystem barcodeSystem) : base(command, barcodeCli, barcodeSystem)
 {
     credit = canBeBoughtOnCredit;
 }
예제 #4
0
 public AddCreditToUser(string[] command, IBarcodeCLI barcodeCli, IBarcodeSystem barcodeSystem) : base(command)
 {
     this.barcodeCli    = barcodeCli;
     this.barcodeSystem = barcodeSystem;
 }
예제 #5
0
 public DisplayAllProductsCommand(string[] command, IBarcodeCLI barcodeCli, IBarcodeSystem barcodeSystem)
     : base(command)
 {
     this.barcodeCli    = barcodeCli;
     this.barcodeSystem = barcodeSystem;
 }
예제 #6
0
 protected ProductSetCommand(string[] command, IBarcodeCLI barcodeCli, IBarcodeSystem barcodeSystem) :
     base(command)
 {
     this.barcodeCli    = barcodeCli;
     this.barcodeSystem = barcodeSystem;
 }
예제 #7
0
 public DisplayUserInfoCommand(string[] command, IBarcodeCLI barcodeCli, IBarcodeSystem barcodeSystem) :
     base(command)
 {
     this.barcodeCli    = barcodeCli;
     this.barcodeSystem = barcodeSystem;
 }
예제 #8
0
 public BuyProductCommand(string[] command, IBarcodeCLI barcodeCli, IBarcodeSystem barcodeSystem) : base(command)
 {
     this.barcodeCli    = barcodeCli;
     this.barcodeSystem = barcodeSystem;
 }