I read a book about TDD. It said stub and mock are different. and It said I should use one mock in a test. but when I use Moq I have no choice but I made many mocks in a test because I don't know how to make a stub using Moq.
Like this.
[Test]
public void TestFunction()
{
var mock_1 = new Mock<IMessage>();
var mock_2 = new Mock<IButton>();
var mock_3 = new Mock<IAuth>();
var logic = new MyClass(mock_1.Object, mock_2.Object, mock_3.Object);
Assert.That(logic);
}
I wanna know if It is right way to make a testcase.
and Please give me a wisdom you have.
Thank you.
Aucun commentaire:
Enregistrer un commentaire