public void TestMultiply() { var c = new MockCalculator(_resultWriter); var result = c.Multiply(3, 2); Assert.Equal(result, 6); }
public void TestException() { var mock = new Mock <IResultWriter>(); mock.Setup(o => o.WriteResult(It.IsAny <double>())).Throws(new IOException("Disk is full")); var c = new MockCalculator(mock.Object); Assert.Throws <IOException>(() => c.Multiply(3, 2)); }