fsprojects / fsprojects.github.io

The website for fsprojects.github.io
http://fsprojects.github.io
Apache License 2.0
6 stars 3 forks source link

Add AutoFixture.AutoFoq project #5

Closed moodmosaic closed 9 years ago

moodmosaic commented 9 years ago

It would be nice to add AutoFixture.AutoFoq – a library which turns AutoFixture into an Auto-mocking Container where the mock instances are created by Foq.


Typical usage

In the test below the mocked instance is created automatically by Foq:

[<Fact>]
let AutoMockInterfaceAndSetupExpectations() =
    // Fixture setup
    let fixture = Fixture().Customize(AutoFoqCustomization())
    let dummy = obj()
    // Exercise system
    let sut = fixture.Create<IInterface>()
    sut.MakeIt(dummy) |> ignore
    // Verify outcome
    Mock.Verify(<@ sut.MakeIt(dummy) @>, Times.Once)
    // Teardown

Integration with xUnit.net

The above test can be written declaratively using xUnit.net's data theories:

[<Theory>][<AutoFoqData>]
let AutoMockInterfaceAndSetupExpectationsDeclaratively 
  (sut : IInterface, dummy : obj) =
    sut.MakeIt(dummy) |> ignore
    Mock.Verify(<@ sut.MakeIt(dummy) @>, Times.Once)

The [AutoFoqData] attribute is defined as:

type AutoFoqDataAttribute() = 
    inherit AutoDataAttribute(
        Fixture().Customize(AutoFoqCustomization()))
moodmosaic commented 9 years ago

Please note that this project is part of the AutoFixture's glue-libraries. Would it be possible to include it at index page while retaining the project's original location?

dsyme commented 9 years ago

Maybe you could submit a PR to modify the Javascript here to read from a list of "other" projects, putting them on the front page?

https://github.com/fsprojects/fsprojects.github.io/blob/master/index.html

moodmosaic commented 9 years ago

I did a test, by modifying the source with Chrome Developer Tools, and it looks like the current JS code works only with GitHub's organization accounts.


Perhaps it would be nice with an index page that could be composed from heterogenous sources:

and so on.

dsyme commented 9 years ago

@moodmosaic - Could you add the project to the Community Projects list? http://fsharp.org/community/projects/

moodmosaic commented 9 years ago

Sure! Done now in fsharp/fsfoundation/#363.