Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

jamiehumphries/FakeItEasy.Auto

Repository files navigation

Build status

####Example

using FakeItEasy;
using FakeItEasy.Auto;
using NUnit.Framework;

public interface IBar
{
    void DoSomething();
}

public class Foo
{
    private readonly IBar bar;

    public Foo(IBar bar)
    {
        this.bar = bar;
    }

    public void MakeBarDoSomething()
    {
        bar.DoSomething();
    }
}

public class FooTests
{
    [Test]
    public void Can_make_bar_do_something()
    {
        // Given
        var foo = An.AutoFaked<Foo>();
        var bar = TheFake<IBar>.UsedBy(foo);
        
        // When
        foo.MakeBarDoSomething();
        
        // Then
        A.CallTo(() => bar.DoSomething()).MustHaveHappened();
    }
}