Пример #1
0
        public void should_throw_exception_if_no_more_room_on_item()
        {
            item = new ItemBuilder()
                   .With(i => i.Id, 500)
                   .With(i => i.ItemSource, new ItemSourceBuilder()
                         .With(i => i.ItemType, PvPStatics.ItemType_Pants)
                         .BuildAndSave()
                         )
                   .With(i => i.Owner, player)
                   .BuildAndSave();

            var rune2 = new ItemBuilder()
                        .With(i => i.Id, 550)
                        .With(i => i.ItemSource, new ItemSourceBuilder()
                              .With(i => i.ItemType, PvPStatics.ItemType_Rune)
                              .BuildAndSave()
                              )
                        .With(i => i.Owner, player)
                        .BuildAndSave();

            item.AttachRune(rune2);

            var cmd = new EmbedRune {
                ItemId = item.Id, RuneId = rune.Id, PlayerId = player.Id
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message
                        .EqualTo("This item has no more room for additional runes."));
        }
Пример #2
0
        public void should_throw_exception_if_rune_id_not_defined()
        {
            var cmd = new EmbedRune {
                PlayerId = 12, ItemId = 250
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo("RuneId is required"));
        }
Пример #3
0
        public void should_throw_exception_if_player_not_found()
        {
            var cmd = new EmbedRune {
                ItemId = item.Id, RuneId = rune.Id, PlayerId = 999
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message
                        .EqualTo("You do not own the item you are attempting to embed runes on."));
        }
Пример #4
0
        public void should_throw_exception_if_rune_not_found()
        {
            var cmd = new EmbedRune
            {
                ItemId   = item.Id,
                RuneId   = 999,
                PlayerId = player.Id
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo("Rune with ID '100' could not be found"));
        }
Пример #5
0
        public void can_embed_a_rune()
        {
            var cmd = new EmbedRune
            {
                ItemId   = item.Id,
                RuneId   = rune.Id,
                PlayerId = player.Id
            };

            Assert.That(Repository.Execute(cmd), Is.EqualTo("You attached your Rune of Leetness onto your Red T-Shirt."));
            Assert.That(item.Runes, Has.Exactly(1).Items);
            Assert.That(item.Runes.First().EmbeddedOnItem.Id, Is.EqualTo(item.Id));
        }
Пример #6
0
        public void should_throw_exception_if_item_not_attachable()
        {
            item = new ItemBuilder()
                   .With(i => i.Id, 500)
                   .With(i => i.ItemSource, new ItemSourceBuilder()
                         .With(i => i.ItemType, PvPStatics.ItemType_Consumable)
                         .BuildAndSave()
                         )
                   .With(i => i.Owner, player)
                   .BuildAndSave();

            var cmd = new EmbedRune {
                ItemId = item.Id, RuneId = rune.Id, PlayerId = player.Id
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo("You cannot embed a rune on this item type."));
        }
Пример #7
0
        public void should_throw_exception_if_rune_not_rune_item_type()
        {
            rune = new ItemBuilder()
                   .With(i => i.Id, 500)
                   .With(i => i.ItemSource, new ItemSourceBuilder()
                         .With(i => i.ItemType, PvPStatics.ItemType_Pants)
                         .BuildAndSave()
                         )
                   .With(i => i.Owner, player)
                   .BuildAndSave();

            var cmd = new EmbedRune {
                ItemId = item.Id, RuneId = rune.Id, PlayerId = player.Id
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo("Only runes can be embedded on items."));
        }
Пример #8
0
        public void should_throw_exception_if_rune_already_equipped_this_turn()
        {
            var rune2 = new ItemBuilder()
                        .With(i => i.Id, 550)
                        .With(i => i.EquippedThisTurn, true)
                        .With(i => i.ItemSource, new ItemSourceBuilder()
                              .With(i => i.ItemType, PvPStatics.ItemType_Rune)
                              .With(i => i.RuneLevel, 1)
                              .BuildAndSave()
                              )
                        .With(i => i.Owner, player)
                        .BuildAndSave();

            var cmd = new EmbedRune {
                ItemId = item.Id, RuneId = rune2.Id, PlayerId = player.Id
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message
                        .EqualTo("This rune has already been equipped once this turn."));
        }
Пример #9
0
        public void should_throw_exception_if_item_insufficent_level()
        {
            item = new ItemBuilder()
                   .With(i => i.Id, 500)
                   .With(i => i.Level, 7)
                   .With(i => i.ItemSource, new ItemSourceBuilder()
                         .With(i => i.ItemType, PvPStatics.ItemType_Pants)
                         .BuildAndSave()
                         )
                   .With(i => i.Owner, player)
                   .BuildAndSave();


            var cmd = new EmbedRune {
                ItemId = item.Id, RuneId = rune.Id, PlayerId = player.Id
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo(
                            "This item is of too low level to attach this rune.  It is level 7 and needs to be at least level 10."));
        }