You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
More concretely named `@fluffy-spoon/substitute` on NPM is a TypeScript port of [NSubstitute](http://nsubstitute.github.io), which aims to provide a much more fluent mocking opportunity for strong-typed languages.
3
+
4
+
## Requirements
5
+
*`TypeScript^3.0.0`
6
+
7
+
## Usage
8
+
Experience full strong-typing of your fakes all the way, and let the TypeScript compiler help with all the dirty work! In the usage example given below, the `exFake` instance is strong-typed all the way, and can be used naturally in a fluent interface!
console.log(exFake.c("something", "there")); //prints undefined (since it doesn't match the parameters)
47
+
48
+
exFake.d.returns(9);
49
+
console.log(exFake.d); //prints 9
50
+
```
51
+
52
+
## But how?
53
+
`@fluffy-spoon/substitute` works the same way that NSubstitute does, except that it uses the EcmaScript 6 `Proxy` class to produce the fakes. You can read more about how NSubstitute works to get inspired.
0 commit comments