typemoq icon indicating copy to clipboard operation
typemoq copied to clipboard

docs need a 'quick start' example

Open uozuAho opened this issue 8 years ago • 1 comments

Hi there, not a big issue, but it did take me a long time to figure out how to mock an interface with the existing documentation. I think some 'quick start' examples near the top of the readme would be handy, something like:

import * as TypeMoq from 'typemoq';

interface IThing {
    name : string;
    getThings(n: number) : string[];
}

let mock = TypeMoq.Mock.ofType<IThing>();
mock.setup(t => t.name).returns(() => "mock thing name");
mock.setup(t => t.getThings(TypeMoq.It.isAny())).returns(() => ["the", "things"]);

console.log(mock.object.name);
console.log(mock.object.getThings(3));

uozuAho avatar Sep 02 '17 05:09 uozuAho

+1

selfinterest avatar Sep 07 '17 17:09 selfinterest