Skip to content

Commit 031d809

Browse files
AAulicinoArthur Aulicino
authored andcommitted
feat: add installation instructions to README.md
1 parent 46c9bab commit 031d809

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,25 @@ Testing and mocking Unity Coroutines can be tricky. This is an extension for
77
[NSubstitute](https://nsubstitute.github.io/) that is designed to help you at mocking Unity
88
Coroutines.
99

10+
## Installation
11+
12+
Unity does not allow specifying a git URL as a dependency of a custom UPM Package.
13+
There are plans to port this to OpenUPM, in the meantime a manual installation is required.
14+
15+
If you don't have NSubstitute already from another source, add this to your **manifest.json**:
16+
17+
```json
18+
"com.aaulicino.nsubstitute": "https://github.com/AAulicino/Unity3D-NSubstitute.git"
19+
```
20+
21+
To install this package, place this in your **manifest.json**:
22+
```json
23+
"com.aaulicino.unity-coroutines-for-nsubstitute": "https://github.com/AAulicino/Unity-Coroutines-for-NSubstitute.git"
24+
```
25+
1026
## Basic use
1127

12-
Lets use this simple counter class using coroutines for testing:
28+
Let's use this simple counter class using coroutines for testing:
1329

1430
```csharp
1531
public class Counter
@@ -24,12 +40,12 @@ Lets use this simple counter class using coroutines for testing:
2440
this.runner = runner;
2541
}
2642

27-
public void StartCounter ()
43+
public void Start ()
2844
{
2945
coroutine = runner.StartCoroutine(CounterRoutine());
3046
}
3147

32-
public void StopCounter ()
48+
public void Stop ()
3349
{
3450
runner.StopCoroutine(coroutine);
3551
coroutine = null;
@@ -82,7 +98,8 @@ The Counter can now be tested as follows:
8298

8399
Calling Runner.MoveNext() will simulate Unity's coroutine update loop.
84100

85-
You can check the [CounterTests.cs](https://github.com/AAulicino/Unity-Coroutines-for-NSubstitute/blob/main/Tests/Editor/Samples/Counter/CounterTests.cs) for test examples on the [Counter](https://github.com/AAulicino/Unity-Coroutines-for-NSubstitute/blob/main/Tests/Editor/Samples/Counter/Counter.cs) class.
101+
You can check the [CounterTests.cs](https://github.com/AAulicino/Unity-Coroutines-for-NSubstitute/blob/main/Tests/Editor/Samples/Counter/CounterTests.cs)
102+
for test examples on the [Counter](https://github.com/AAulicino/Unity-Coroutines-for-NSubstitute/blob/main/Tests/Editor/Samples/Counter/Counter.cs) class.
86103

87104
Since MonoBehaviours implement all methods specified in the ICoroutineRunner interface, you can
88105
simply add it to your MonoBehaviour, for example:

0 commit comments

Comments
 (0)