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); }
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); }