Exemple #1
0
        public async Task CreateAsync_Should_Throw_If_Incorrect_Destination_Provided()
        {
            using var context = await GetDatabase();

            var dungeonService = new DungeonService(context, null, null);

            var dungeonCreateBindingModel = new DungeonCreateBindingModel
            {
                DateTime    = DateTime.Now,
                Description = "TestDescr",
                Destination = "TestDest2",
                LeaderId    = "TestChar1"
            };

            await Assert.ThrowsAsync <ArgumentException>(async() => await dungeonService.CreateAsync(dungeonCreateBindingModel));
        }
Exemple #2
0
        public async Task CreateAsync_Should_Register_Dungeon_In_Database()
        {
            using var context = await GetDatabase();

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

            var dungeonCreateBindingModel = new DungeonCreateBindingModel
            {
                DateTime    = DateTime.Now,
                Description = "TestDescr",
                Destination = "TestDest",
                LeaderId    = "1"
            };

            await dungeonService.CreateAsync(dungeonCreateBindingModel);

            var expected = 2;
            var actual   = context.Dungeons.Count();

            Assert.Equal(expected, actual);
        }
        public async Task <IActionResult> CreateAsync(DungeonCreateBindingModel inputModel)
        {
            await this.dungeonService.CreateAsync(inputModel);

            return(RedirectToAction("Upcoming", "Events"));
        }