public void should_dispose_resource() { var resource = new Disposable(); resource.Disposed.Should().Be(false); var withUsing = FunctionalUsing.Using <int, int>( resource, x => x * 2); withUsing(10); resource.Disposed.Should().Be(true); }
public void should_invoke_the_function() { bool invoked = false; Func <int, int> doubleMe = x => { invoked = true; return(x * 2); }; var resource = new Disposable(); var withResource = FunctionalUsing.Using(resource, doubleMe); withResource(10).Should().Be(20); invoked.Should().Be(true); }