Exemplo n.º 1
0
        public async Task Edit_Should_Properly_Edit_Character()
        {
            using var context = await GetDatabase();

            var mapper           = this.GetMapper();
            var characterService = new CharacterService(context, mapper);
            var dungeonService   = new DungeonService(context, characterService, mapper);

            var dungeonEditBindingModel = new DungeonEditBindingModel
            {
                DungeonId   = "1",
                Description = "Updated"
            };

            await dungeonService.EditAsync(dungeonEditBindingModel);

            var expected = "Updated";
            var actual   = context.Dungeons.First().Description;

            Assert.Equal(expected, actual);
        }
Exemplo n.º 2
0
        public async Task Edit_Should_Not_Update_If_Description_Is_Null_Or_Empty(string description)
        {
            using var context = await GetDatabase();

            var mapper           = this.GetMapper();
            var characterService = new CharacterService(context, mapper);
            var dungeonService   = new DungeonService(context, characterService, mapper);

            var dungeonEditBindingModel = new DungeonEditBindingModel
            {
                DungeonId   = "1",
                Description = description
            };

            await dungeonService.EditAsync(dungeonEditBindingModel);

            var expected = "Initial";
            var actual   = context.Dungeons.First().Description;

            Assert.Equal(expected, actual);
        }
        public async Task <IActionResult> EditAsync(DungeonEditBindingModel input)
        {
            await this.dungeonService.EditAsync(input);

            return(this.RedirectToAction(nameof(Details), new { id = input.DungeonId }));
        }