Hey. I am new to Moq testing and it is not easy to make a simple statement. I am using the interface
public interface IAdd { void add(int a, int b); }
Moq for IAdd interface:
Mock<IAdd> mockadd = new Mock<IAdd>(); mockadd.Setup(x => x.add(It.IsAny<int>(), It.IsAny<int>()).callback((int a, int b) => { a+b;}); IAdd testing = mockadd.Object;
Since the add method is not valid, it does not return any value for Assert with. How can I approve this setting?
c # unit-testing nunit moq
J. Davidson
source share