示例#1
0
        public void TestValidate_BadBehaviour()
        {
            WorldValidator v = new WorldValidator();

            var w    = new World();
            var blue = new ItemBlueprint
            {
                Name       = "Hammer",
                Behaviours =
                    new List <BehaviourBlueprint>()
                {
                    new BehaviourBlueprint()
                    {
                        OnPush = new BehaviourEventHandlerBlueprint()
                        {
                            Effect = new List <EffectBlueprint> {
                                new EffectBlueprint {
                                    Lua = "aa + bb + cc"
                                }
                            }
                        }
                    }
                }
            };

            v.ValidateItem(w, w.ItemFactory.Create(w, blue), new Room("Test Room", w, 't'));

            StringAssert.Contains(@"Error testing OnPush of Behaviour Unnamed Object of on 'Hammer' in room 'Test Room' with test actor 'test actor'", v.Warnings.ToString());
        }
示例#2
0
        public void TestValidate_SlotNotFound()
        {
            WorldValidator v = new WorldValidator();

            var w    = new World();
            var blue = new ItemBlueprint
            {
                Name = "Hammer",
                Slot = new ItemSlot("Handers", 5)
            };

            v.ValidateItem(w, w.ItemFactory.Create(w, blue), Mock.Of <IRoom>());

            StringAssert.Contains(@"Item Hammer lists Slot named Handers but no Actors or Default slots are listed with that name (Slots seen were '')", v.Warnings.ToString());
        }