public async Task <IActionResult> GetAsync()
        {
            IEnumerable <DependentDomainModel> models;

            try { models = await _domain.GetAsync().ConfigureAwait(false); }
            catch (Exception ex) { return(BadRequest(ex.InnerException)); }

            return(Ok(models));
        }
Esempio n. 2
0
        public async void GetAsync_ReturnAll()
        {
            var domainModels = new List <DependentDomainModel> {
                CreateDomain(), CreateDomain(), CreateDomain()
            };
            var models = ToListModel <Dependent, DependentDomainModel>(domainModels);

            _repository.Setup(x => x.GetAsync()).ReturnsAsync(models);

            var result = await _domain.GetAsync().ConfigureAwait(false);

            result.Should().AllBeOfType <DependentDomainModel>();
            result.Should().BeEquivalentTo(domainModels);
        }