public void Verify_TestOne_Out_FunctionCallWithOutput() { var testOneMock = new Mock <ITestOne>(); var mathOne = new MathOne(testOneMock.Object); var msg = "Some Text"; mathOne.Out(msg); testOneMock.Verify(x => x.Out(msg), Times.Exactly(1)); }
public void MathOneAddsTwoNumbers() { //определяем поведение интерфейса ITestOne var testOneMock = new Mock <ITestOne>(); testOneMock.Setup(x => x.Add(1, 1)).Returns(2); var mathOne = new MathOne(testOneMock.Object); Assert.Equal(2, mathOne.Add(1, 1)); }
static void Main(string[] args) { Console.WriteLine("Please enter a number."); int value = Convert.ToInt32(Console.ReadLine()); MathOne outcome1 = new MathOne(value); MathTwo outcome2 = new MathTwo(value); MathThree outcome3 = new MathThree(value); Console.WriteLine(outcome1.a); Console.WriteLine(outcome2.b); Console.WriteLine(outcome3.c); Console.ReadLine(); }