I am working on .NET CORE 3.1 nUnit tests. I have class ClassX
with ServicesClassX
interface injected in its constructor. Within the ClassX, there is private method from where it is calling public method from ServiceClassX. I want to know, how I can verify that this method from ServiceClassX is been called??
I need to test if ServiceClassX.ProcessAzureMessage(message)
method been called/ verify.
ClassX
public class ClassX
{
private readonly IServiceClassX ServiceClassX;
public ClassX(IServiceClassX services){
ServiceClassX = services;
}
public Customer Run(){
var cus = MethodX();
return cus;
}
private Customer MethodX(){
bool valueExit = true;
string message = "myRecord";
if(valueExit){
ServiceClassX.ProcessAzureMessage(message);
}
}
nUnit
[TestFixture]
public class ClassXTests
{
private readonly ClassX _sut;
private readonly Mock<IServiceClassX> _serviceClassXMoq;
public ClassXTests(){
this._sut = new ClassX(_serviceClassXMoq.Object)
}
[Test]
public void Test1()
{
var customer = _sut.();
_serviceClassXMoq.Verify(?????????
}