public void TestFailure() { var mockBash = new Mock <IBashRunner>(); var process = new Mock <ProcessWrapper>(); process.Setup(x => x.ExitCode).Returns(1); mockBash.Setup(x => x.RunCommand(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <int?>(), It.IsAny <int?>())).Returns(process.Object); var service = new ImageDiffController(mockBash.Object); Assert.Throws <ExceptionNoFsWebCam>(() => service.TakeBaselineImages(new[] { 1, 2 })); }
public void TestSetBase() { var mockBash = new Mock <IBashRunner>(); var process = new Mock <ProcessWrapper>(); process.Setup(x => x.ExitCode).Returns(0); mockBash.Setup(x => x.RunCommand(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <int?>(), It.IsAny <int?>())).Returns(process.Object); var service = new ImageDiffController(mockBash.Object); service.TakeBaselineImages(new[] { 1, 2 }); mockBash.Verify(x => x.RunCommand(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <int?>(), It.IsAny <int?>()), Times.Exactly(2)); }