Exemplo n.º 1
0
        public void RemoveItemCreatorEquipmentTests()
        {
            var testee = new RandomItemCreatorEquipment();

            testee.Initialize(0, _module, 1);
            _module.AddEquipment(testee);

            _module.RemoveEquipment(testee);
            testee.Takt();

            _module.ItemCount.Should().Be(0);
            testee.CreatedItemCount.Should().Be(0);
        }
Exemplo n.º 2
0
        public void RandomItemCreatorEquipmentTests()
        {
            var testee = new RandomItemCreatorEquipment();

            testee.Initialize(0, _module, 1);
            testee.MonitorEvents();
            _module.AddEquipment(testee);

            // if module is not active it must not create items
            _module.IsActive = false;
            testee.Takt();
            testee.ItemPassedCount.Should().Be(0);
            _module.ItemCount.Should().Be(0);

            _module.IsActive = true;
            testee.Takt();
            testee.ItemPassedCount.Should().Be(1);
            testee.ShouldRaise("ItemCreated")
            .WithSender(testee)
            .WithArgs <ItemCreatorEventArgs>(a => a.CreatedItem.Metadata.ContainsKey("barcode"));
            _module.ItemCount.Should().Be(1);
            _module.GetItemByPosition(0).Metadata.Should().ContainKey("barcode");
        }