public async Task CreateAsync_CallsCreate(OrganizationConnectionData<BillingSyncConfig> data,
            SutProvider<CreateOrganizationConnectionCommand> sutProvider)
        {
            await sutProvider.Sut.CreateAsync(data);

            await sutProvider.GetDependency<IOrganizationConnectionRepository>().Received(1)
                .CreateAsync(Arg.Is(AssertHelper.AssertPropertyEqual(data.ToEntity())));
        }
        public async Task <OrganizationConnection> UpdateAsync <T>(OrganizationConnectionData <T> connectionData) where T : new()
        {
            if (!connectionData.Id.HasValue)
            {
                throw new Exception("Cannot update connection, Connection does not exist.");
            }

            var connection = await _organizationConnectionRepository.GetByIdAsync(connectionData.Id.Value);

            if (connection == null)
            {
                throw new NotFoundException();
            }

            var entity = connectionData.ToEntity();
            await _organizationConnectionRepository.UpsertAsync(entity);

            return(entity);
        }
 public async Task <OrganizationConnection> CreateAsync <T>(OrganizationConnectionData <T> connectionData) where T : new()
 {
     return(await _organizationConnectionRepository.CreateAsync(connectionData.ToEntity()));
 }