示例#1
0
        public void Select_Product_Empty_Not_Enough_Coin_Updates_Display()
        {
            // Arrange
            IContext context = new NotEnoughProductInventoryContext();
            var      result  = new Result();
            var      machine = new Machine();

            machine.Boot(context, (r) => { result.Push(r); });
            var metal = Metal.Quarter;

            // Act
            machine.Select(context, "A", (r) => { result.Push(r); }).Wait();

            // Arrange
            Assert.IsTrue(context.DisplayMessage.MessageStack.Contains(Tags.SoldOut));
            Assert.IsTrue(context.DisplayMessage.MessageStack.Contains(Tags.InsertCoin));
        }
示例#2
0
        public void SoldOut_01_Pos_Inventory_Empty_Returns_Error()
        {
            // Arrange
            IContext context = new NotEnoughProductInventoryContext();
            var      machine = new Machine();
            var      metal   = Metal.Quarter;
            var      result  = new Result();

            // Act
            machine.Insert(metal, context, (r) => { result.Push(r); }).Wait();
            machine.Insert(metal, context, (r) => { result.Push(r); }).Wait();
            machine.Insert(metal, context, (r) => { result.Push(r); }).Wait();
            machine.Insert(metal, context, (r) => { result.Push(r); }).Wait();
            machine.Select(context, "A", (r) => { result.Push(r); }).Wait();

            // Arrange
            Assert.IsFalse(context.AvailableBins.Items.Any(i => i.Id == "A"));
            Assert.IsTrue(context.DisplayMessage.MessageStack.Contains(Tags.SoldOut));
            Assert.IsTrue(context.DisplayAmount.MessageStack.Contains("$1.00"));
        }