I have the following Interface & Class and I also wrote a unit test as shown down, but I got an exception:
Assertion failed for the following call: AsyncConsole.example1.IPlayer.Start(i: 1) Expected to find it once or more but didn't find it among the calls:
Is there a way to solve that?
public interface IPlayer
{
public void Play();
public void Start(int i);
}
public class Player : IPlayer
{
public void Play()
{
Start(1);
}
public void Start(int i)
{
Console.WriteLine("Start " + i);
}
}
Test class
using FakeItEasy;
using Xunit;
namespace TestProject
{
public class TestPlayer
{
[Fact]
public void Play_WhenCalled_ShouldCallStart()
{
var player = A.Fake<IPlayer>();
player.Play();
//assert
A.CallTo(() => player.Start(1)).MustHaveHappened();
}
}
}
Message:
FakeItEasy.ExpectationException :
Assertion failed for the following call:
AsyncConsole.example1.IPlayer.Start(i: 1)
Expected to find it once or more but didn't find it among the calls:
1: IPlayer.Play()