public void Decrypt_CallsGpg() { var transportMock = new Mock <IGpgTransport>(); transportMock.Setup(t => t.CallGpg(It.IsAny <string>(), null)).Returns(GetSuccessResult); var gpg = new GPG(transportMock.Object, Mock.Of <IGpgAgent>(), StubGpgResultVerifier.AlwaysValid, new GpgConfig()); gpg.Decrypt("file"); transportMock.Verify(t => t.CallGpg(It.IsAny <string>(), null), Times.Once); }
public void Decrypt_ReturnsFileContent(string fileContent) { var transportMock = new Mock <IGpgTransport>(); transportMock.Setup( t => t.CallGpg(It.IsNotNull <string>(), null)) .Returns(new GpgResultBuilder() .WithStdout(fileContent) .Build()); var gpg = new GPG(transportMock.Object, Mock.Of <IGpgAgent>(), StubGpgResultVerifier.AlwaysValid, new GpgConfig()); var decryptedContent = gpg.Decrypt("file"); decryptedContent.ShouldBe(fileContent); }