/**
  * @magentoDbIsolation enabled
  */
 public function testCreateCustomerInServiceVsInModel()
 {
     $email = '*****@*****.**';
     $email2 = '*****@*****.**';
     $firstname = 'Tester';
     $lastname = 'McTest';
     $groupId = 1;
     $password = '******';
     /** @var \Magento\Customer\Model\Customer $customerModel */
     $customerModel = $this->_objectManager->create('Magento\\Customer\\Model\\CustomerFactory')->create();
     $customerModel->setEmail($email)->setFirstname($firstname)->setLastname($lastname)->setGroupId($groupId)->setPassword($password);
     $customerModel->save();
     /** @var \Magento\Customer\Model\Customer $customerModel */
     $savedModel = $this->_objectManager->create('Magento\\Customer\\Model\\CustomerFactory')->create()->load($customerModel->getId());
     $dataInModel = $savedModel->getData();
     $this->_customerBuilder->setEmail($email2)->setFirstname($firstname)->setLastname($lastname)->setGroupId($groupId);
     $newCustomerEntity = $this->_customerBuilder->create();
     $customerDetails = $this->_customerDetailsBuilder->setCustomer($newCustomerEntity)->create();
     $customerData = $this->_customerAccountService->createCustomer($customerDetails, $password);
     $this->assertNotNull($customerData->getId());
     $savedCustomer = $this->_customerAccountService->getCustomer($customerData->getId());
     $dataInService = \Magento\Framework\Service\DataObjectConverter::toFlatArray($savedCustomer);
     $expectedDifferences = ['created_at', 'updated_at', 'email', 'is_active', 'entity_id', 'entity_type_id', 'password_hash', 'attribute_set_id', 'disable_auto_group_change', 'confirmation', 'reward_update_notification', 'reward_warning_notification'];
     foreach ($dataInModel as $key => $value) {
         if (!in_array($key, $expectedDifferences)) {
             if (is_null($value)) {
                 $this->assertArrayNotHasKey($key, $dataInService);
             } else {
                 $this->assertEquals($value, $dataInService[$key], 'Failed asserting value for ' . $key);
             }
         }
     }
     $this->assertEquals($email2, $dataInService['email']);
     $this->assertArrayNotHasKey('is_active', $dataInService);
     $this->assertArrayNotHasKey('updated_at', $dataInService);
     $this->assertArrayNotHasKey('password_hash', $dataInService);
 }