Question

Suppose I have a context that is configured similar to:

Establish context = () =>
    {
        ...

        IFileProcesser processer = new FileProcesser();

        The<IFileProcesser>()
            .WhenToldTo(x => x.Read(Param<Stream>.IsAnything))
            .Return<Stream>(processer.Read);

        ...
    };

Is there a better way to tell Machine.Fakes to not fake IFileProcesser and use the implementation of FileProcesser?

Was it helpful?

Solution

You can use the Configure method for this.

Establish context = () =>
{
    Configure(x => x.For<IFileProcesser>().Use<FileProcesser>());
};

If something is registered that way (there're several overloads of Use) it has precedence over the auto mocking capabilities.

HTH

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top