示例#1
0
        public void should_throw_exception_if_item_id_not_defined()
        {
            var cmd = new UnembedRune
            {
                PlayerId = player.Id
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo("ItemId is required"));
        }
示例#2
0
        public void should_throw_exception_if_item_not_found()
        {
            var cmd = new UnembedRune
            {
                PlayerId = player.Id,
                ItemId   = 999
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo("Rune with id '999' could not be found!"));
        }
示例#3
0
        public void should_throw_exception_if_player_not_found()
        {
            var cmd = new UnembedRune
            {
                PlayerId = 999,
                ItemId   = rune1.Id
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo("You don't own this rune!"));
        }
示例#4
0
        public void can_unembed_a_rune()
        {
            var cmd = new UnembedRune
            {
                PlayerId = player.Id,
                ItemId   = rune1.Id
            };

            Assert.That(Repository.Execute(cmd), Is.EqualTo("You unembedded your <b>Test Item Source</b>."));
            Assert.That(item1.Runes, Is.Empty);
            Assert.That(rune1.EmbeddedOnItem, Is.Null);
        }
示例#5
0
        public void should_throw_exception_if_rune_not_on_item()
        {
            var rune2 = new ItemBuilder()
                        .With(i => i.Id, 201)
                        .With(i => i.ItemSource, new ItemSourceBuilder()
                              .With(i => i.ItemType, PvPStatics.ItemType_Rune)
                              .BuildAndSave()
                              )
                        .With(i => i.Owner, player)
                        .BuildAndSave();

            var cmd = new UnembedRune
            {
                PlayerId = player.Id,
                ItemId   = rune2.Id
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message
                        .EqualTo("This rune is not currently embdded on an item."));
        }
示例#6
0
        public void should_throw_exception_if_rune_already_equipped_this_turn()
        {
            var rune2 = new ItemBuilder()
                        .With(i => i.Id, 201)
                        .With(i => i.ItemSource, new ItemSourceBuilder()
                              .With(i => i.ItemType, PvPStatics.ItemType_Rune)
                              .BuildAndSave()
                              )
                        .With(i => i.Owner, player)
                        .With(i => i.EquippedThisTurn, true)
                        .With(i => i.EmbeddedOnItem, item1)
                        .BuildAndSave();

            var cmd = new UnembedRune
            {
                PlayerId = player.Id,
                ItemId   = rune2.Id
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message
                        .EqualTo("This rune was equipped this turn.  Wait until next turn to remove it."));
        }