Expected invocation on the mock once, but was 0 times: x => x.UpdateCustomer(It.IsAny<Customer>())

I Wanna test Register Customer method when we request it value and after update customer in this method my test check the value after the update this method but this is my test

private Mock<ICustomerService> _ICustomerServiceMock;


[Test]
public void Customer_SetUserName()
{
    var customer = _customerService.GetCustomerByEmail("a@b.com");
    Customer savecustomerupdate= null;
    _ICustomerServiceMock.Setup(x => x.UpdateCustomer(It.IsAny<Customer>())
        .Callback<Customer>(update=>
         {
             savecustomerupdate= update;
         });

    var request = new CustomerRegistrationRequest(customer, GetRandom.Email(8, 10), GetRandom.String(10, 10), null, PasswordFormat.Hashed, 1);
    var result = _customerRegistrationService.RegisterCustomer(request);

    _ICustomerServiceMock.Verify(x => x.UpdateCustomer(It.IsAny<Customer>()), Times.Once); // Expected invocation on the mock once, but was 0 

    Assert.NotNull(savedDeskBooking);
    Assert.AreEqual(customer.Email, savedDeskBooking.Email);
    Assert.AreEqual(customer.Password, savedDeskBooking.Password);
}

and this is register method

public virtual CustomerRegistrationResult RegisterCustomer(CustomerRegistrationRequest request)
{
   //after some opration

   _customerService.UpdateCustomer(request.Customer);
}
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum