public string DoAThing(string withThis, int withThat) { var someResult = _dep1.Result(withThis); someResult += withThat; return(someResult.ToString()); }
public void Lib2AutofixtureAutoFakeItEasy( [Frozen] IDependency1 dep1, string withThis, int withThat, AwesomeClass sut) { // Arrange no longer needed: // no test specific setup is required for this test // Act sut.DoAThing(withThis, withThat); // Assert A.CallTo(() => dep1.Result(withThis)).MustHaveHappenedOnceExactly(); }
public void DoAThing_WhenCalled_ExampleWithSetup( [Frozen] IDependency1 dep1, AwesomeClass sut) { // Arrange var withThis = "<SomeUserInputThatWillLookLikeThis>"; var withThat = 3; // Also a specific case // Setup the interface to respond with the value expected from that // interface when calling it. A.CallTo(() => dep1.Result(withThis)).Returns(5); // Act var result = sut.DoAThing(withThis, withThat); // Assert result.Should().Be("8"); }