コード例 #1
0
        public async Task EditEffect_UpdateEffectInDatabase()
        {
            var expectedEffect   = CreateEffect(42, subCategoryId: 1, offset: 1);
            var executionContext = new NaheulbookExecutionContext();
            var previousEffect   = AutoFill <Effect> .One(AutoFillFlags.RandomizeString | AutoFillFlags.RandomInt, new AutoFillSettings { MaxDepth = 1 }, (i) => new { Category = i.SubCategory });

            var editEffectRequest = AutoFill <EditEffectRequest> .One();

            previousEffect.Id = 42;

            _effectRepository.GetWithModifiersAsync(42)
            .Returns(previousEffect);

            await _effectService.EditEffectAsync(executionContext, 42, editEffectRequest);

            await _unitOfWork.Received(1)
            .SaveChangesAsync();

            previousEffect.Should().BeEquivalentTo(expectedEffect);
        }