blairconrad / FakeItEasy.Auto

A simple little autofaker for FakeItEasy.

Home Page:http://jamiehumphries.github.io/FakeItEasy.Auto/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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();
    }
}

About

A simple little autofaker for FakeItEasy.

http://jamiehumphries.github.io/FakeItEasy.Auto/

License:MIT License


Languages

Language:C# 98.3%Language:Shell 1.7%