Exemplo n.º 1
0
        public void GivenEquipmentAlreadyAtModule_WhenAddEquipment_ShouldThrowException()
        {
            var equipment = new CustomActionEquipment();

            equipment.Initialize(0, a => {});
            _testee.AddEquipment(equipment);

            var action = new Action(() => _testee.AddEquipment(equipment));

            action.ShouldThrow <SimulationException>();
        }
Exemplo n.º 2
0
        public void WhenItemPassesEquipment_ShouldAddLogHistory()
        {
            var item = new SimulatedItem();

            _testee.AddItem(item);
            var customActionEquipment = new CustomActionEquipment();

            customActionEquipment.Initialize(1, i => {});
            _testee.AddEquipment(customActionEquipment);

            _testee.Takt();

            item.LogHistory.Should().Contain("passed equipment CustomActionEquipment");
        }
Exemplo n.º 3
0
        public void WhenAddEquipmentToWrongSlot_ShouldThrowException()
        {
            var equipment1 = new CustomActionEquipment();
            var equipment2 = new CustomActionEquipment();

            equipment1.Initialize(-1, a => {});
            equipment2.Initialize(999999, a => { });

            var action1 = new Action(() => _testee.AddEquipment(equipment1));
            var action2 = new Action(() => _testee.AddEquipment(equipment2));

            action1.ShouldThrow <SimulationException>("equipment position must be >= 0");
            action2.ShouldThrow <SimulationException>("equipment position must not exceed length of ModuleSimulator");
        }
Exemplo n.º 4
0
        public void GivenEquipmentOnPosition1_WhenItemPassed_ShouldCallCustomAction()
        {
            var item = new SimulatedItem {
                ItemId = 1
            };

            _testee.AddItem(item);

            bool customActionWasCalled = false;
            var  customActionEquipment = new CustomActionEquipment();

            customActionEquipment.Initialize(1, i =>
            {
                customActionWasCalled = true;
            });
            _testee.AddEquipment(customActionEquipment);

            customActionWasCalled.Should().BeFalse("item is still on position 0");

            _testee.Takt();

            customActionWasCalled.Should().BeTrue("item just passed equipment on position 1");
        }