示例#1
0
        public async Task WhenBulkPostPersonItShouldReturnTotalNumberOfPerson()
        {
            var persons = _fixture.Create <Person[]>();

            _dataService
            .SaveItemsAsync(persons)
            .Returns(persons.Length);

            var actual = await _personsController.PostBulkAsync(persons);

            actual
            .Value
            .Should()
            .Be(persons.Length);
        }
示例#2
0
        public async Task <ActionResult <int> > PostBulkAsync(Person[] persons)
        {
            if (persons == null)
            {
                return(BadRequest());
            }

            var result = 0;

            await _transactionManager.DoInTransactionAsync(async() =>
            {
                result = await _dataService.SaveItemsAsync(persons);
            });

            return(result);
        }