I am trying to Mock a method that Action<T> delegate. The goal is to mock the Action.Invoke and Assert if the correct value get sent back , but the following code does not seem to work. Any pointers ?
Jay
Jay
public interface IClientServerMockingTest{ void CallMethod(string id, Action<string> status);}[TestClass]public class ClientServerMockingTest : IClientServerMockingTest{ [TestMethod] public void TestMethod1() { var clientServer = Mock.Create<ClientServerMockingTest>(); var action = Mock.Create<Action<string>>(); Mock.Arrange(() => clientServer.CallMethod("demo", action)).Raises(() => clientServer.CallMethod("demo", action)); clientServer.CallMethod("demo", action); Mock.Assert(clientServer); } public void CallMethod(string id, Action<string> action) { action.Invoke("worked"); }}