|
| 1 | +# Licensing |
| 2 | + |
| 3 | +This section will describe all available My Tested ASP.NET Core MVC editions and their licensing options. |
| 4 | + |
| 5 | +## Editions |
| 6 | + |
| 7 | +The testing library has four different editions available for you to explore: |
| 8 | + |
| 9 | +### Lite |
| 10 | + |
| 11 | +The **"Lite"** edition of the library provides only a small subset of the available setups and assertions but they are more than sufficient for controller and view component testing. |
| 12 | + |
| 13 | +- Perfect for small MVC applications |
| 14 | +- Completely free and unlimited |
| 15 | +- Includes only **"Controllers"**, **"ViewActionResults"** and **"ViewComponents"** |
| 16 | +- Cannot be used in combination with any other package |
| 17 | +- Requires manual mock creation of commonly used services |
| 18 | +- Can be used by everyone |
| 19 | +- [Apache or Microsoft Public License](https://github.com/ivaylokenov/MyTested.AspNetCore.Mvc/blob/development/src/MyTested.AspNetCore.Mvc.Lite/LICENSE) |
| 20 | + |
| 21 | +### Community |
| 22 | + |
| 23 | +The **"Community*"" edition of the library is fully unlocked and the whole fluent testing API can be used for free. This edition is exclusively available only for individuals, open-source projects, startups and educational institutions. |
| 24 | + |
| 25 | +- Perfect for every MVC application complying with the special terms |
| 26 | +- Completely free and unlimited |
| 27 | +- Developers can include [any package they prefer](/guide/packages.html) |
| 28 | +- Available only for individuals and special types of businesses and organizations |
| 29 | +- Fully featured edition |
| 30 | +- License code can be requested from [HERE](https://mytestedasp.net/Core/Mvc#free-usage-modal) for free |
| 31 | + |
| 32 | +### Trial |
| 33 | + |
| 34 | +The **"Trial"** edition of the library is fully featured but allows up to 100 assertions (around 25 unit tests) per test project. You may use it in multiple projects to overcome this limitation or just write only a few tests with it (for example asserting a very important route in your application) |
| 35 | + |
| 36 | +- Perfect for previewing the framework |
| 37 | +- Completely free with limitations |
| 38 | +- Allows up to 100 assertions (around 25 unit tests) per test project |
| 39 | +- Developers can include [any package they prefer](/guide/packages.html) |
| 40 | +- Fully featured edition |
| 41 | +- Can be used by everyone |
| 42 | +- The limitation can be removed by providing a license code |
| 43 | + |
| 44 | +### Commercial |
| 45 | + |
| 46 | +The **"Commercial"** edition of the library is fully unlocked and unlimited. Requires a paid license code. |
| 47 | + |
| 48 | +- Perfect for every MVC application |
| 49 | +- No limitations |
| 50 | +- Requires paid license code |
| 51 | +- Developers can include [any package they prefer](/guide/packages.html) |
| 52 | +- Fully featured edition |
| 53 | +- Can be used by everyone |
| 54 | +- License code can be purchased from [HERE](https://mytestedasp.net/Core/Mvc#pricing) |
| 55 | + |
| 56 | +Choose wisely! :) |
| 57 | + |
| 58 | +## Registering a license code |
| 59 | + |
| 60 | +If you followed the tutorial strictly, you should have reached the free trial version limitations of My Tested ASP.NET Core MVC. When you run a single test (no matter which one), it should pass. But if we try to run them all at once, you should receive the following exception: |
| 61 | + |
| 62 | +``` |
| 63 | +The free-quota limit of 100 assertions per test project has been reached. Please visit https://mytestedasp.net/core/mvc#pricing to request a free license or upgrade to a commercial one. |
| 64 | +``` |
| 65 | + |
| 66 | +We will now register a license code in **"MusicStore.Test"** and remove this restriction. Create a **"testconfig.json"** file at the root of the project: |
| 67 | + |
| 68 | +<img src="/images/tutorial/testconfigfile.jpg" alt="testconfig.json file at the root of the project" /> |
| 69 | + |
| 70 | +Then add the following JSON in it: |
| 71 | + |
| 72 | +```json |
| 73 | +{ |
| 74 | + "License": "1-0GEPhlzJ+jgqzGg+hQPo19wbRvEN0C4LjGm9YDTErbLzcTROsj3fU177Unj7wlOCNE0ciZCB5aw8jt4EEDczpW6S/lW0PkU8ZBjqh6F2ev42hqcgtlEKmBRwomPKj/PUElAo1iIdkLn3/il3o8HAsum7bKMqv7QPpOSwy/TuAGYxOjIwMTctMTAtMTU6YWRtaW5AbXl0ZXN0ZWRhc3AubmV0Ok11c2ljIFN0b3JlIFNhbXBsZSBUZXN0czpEZXZlbG9wZXI6TXVzaWNTdG9yZS4=" |
| 75 | +} |
| 76 | +``` |
| 77 | + |
| 78 | +This license is tied to the **"MusicStore.Test"** project. To unlock the testing framework limitations, we need to do one more thing. Go to the **"project.json"** file and add **"testconfig.json"** in the **"copyToOutput"** array: |
| 79 | + |
| 80 | +```json |
| 81 | +"buildOptions": { |
| 82 | + "preserveCompilationContext": true, |
| 83 | + "copyToOutput": [ |
| 84 | + "config.json", |
| 85 | + "testconfig.json" |
| 86 | + ] |
| 87 | +}, |
| 88 | +``` |
| 89 | + |
| 90 | +From now on the **"testconfig.json"** file will be copied to the build output directory and My Tested ASP.NET Core MVC will be able to read it successfully. More information about the test configuration can be found [HERE](/guide/testconfig.html). |
| 91 | + |
| 92 | +Rebuild the solution and run the tests again. All of them should pass. We have unlocked the full version of the library! :) |
| 93 | + |
| 94 | +Additional details about the licensing of the testing framework can be found [HERE](/guide/licensing.html). |
| 95 | + |
| 96 | +## Section summary |
| 97 | + |
| 98 | +Since now we have used the **"Trial"** edition of My Tested ASP.NET Core MVC. It was working fine but we have reached its limitations while still having a lot of tests to write for our web application. After providing a license code in the test project, we are now able to successfully assert with the fully-featured and unlimited **"Community"** edition. Now let's get back to the code and test some [Attributes](/tutorial/attributes/html)! |
0 commit comments