示例#1
0
        /// <summary> <see cref="IDependentDomain.InsertAsync"/> </summary>
        /// <exception cref="ArgumentNullException"><paramref name="domainModel"/> is <see langword="null"/></exception>
        public async Task <DependentDomainModel> InsertAsync(DependentDomainModel domainModel)
        {
            if (domainModel == null)
            {
                throw new ArgumentNullException(nameof(domainModel));
            }

            var model = ToModel <Dependent, DependentDomainModel>(domainModel);

            model = await _repository.InsertAsync(model).ConfigureAwait(false);

            domainModel = ToModel <DependentDomainModel, Dependent>(model);

            return(domainModel);
        }
        public void InsertAsync_WithNullDependentParameter_ReturnArgumentNullException()
        {
            Func <Task> act = () => _repository.InsertAsync(null);

            act.Should().Throw <ArgumentNullException>();
        }