Here's an example of how you can verify if one of more methods were called on a fake object.
public interface IBlah
{
void Delete(int x);
int Add(int x, int y);
int Subtract(int x, int y);
}
public class Something
{
private readonly IBlah _blah;
public Something(IBlah blah) { _blah = blah; }
public void DoSomething(int x, int y )
{
// _blah.Add(x, y);
_blah.Subtract(x, y);
}
}
Above is just a trivial system to test
[Fact]
public void TestFeature()
{
var fake = A.Fake<IBlah>();
var something = new Something(fake);
something.DoSomething(1, 2);
var callResults = Fake.GetCalls(fake).Any(call =>
{
var x = call.GetArgument<int>("x");
var y = call.GetArgument<int>("y");
return call.Method.Name == "Add" || call.Method.Name == "Subtract"
&& x == 1 && y == 2;
});
Assert.True(callResults);
}
Above immediate snippet above is a XUnit test that verifies if either Add or Subtract were called with the giving values for the parameters x =1, y = 2