Skip to content

Commit fbb480e

Browse files
Update v15
1 parent 284b75a commit fbb480e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

15/umbraco-cms/implementation/unit-testing.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,23 +159,21 @@ public class PageSurfaceControllerTests
159159
`ServiceContext.CreatePartial()` has optional parameters, and by naming them you only need to mock the dependencies that you need, for example: `ServiceContext.CreatePartial(contentService: Mock.Of<IContentService>());`
160160
{% endhint %}
161161

162-
## Testing an UmbracoApiController
162+
## Testing an ApiController
163163

164164
See [Reference documentation on UmbracoApiControllers](../reference/routing/umbraco-api-controllers/README.md#locally-declared-controller).
165165

166-
{% hint style="warning" %}
167-
The example below uses UmbracoApiController which is obsolete in Umbraco 14 and will be removed in Umbraco 15.
168-
{% endhint %}
169-
170166
```csharp
167+
[ApiController]
168+
[Route("/umbraco/api/products")]
171169
public class ProductsController : UmbracoApiController
172170
{
173171
public IEnumerable<string> GetAllProducts()
174172
{
175173
return new[] { "Table", "Chair", "Desk", "Computer", "Beer fridge" };
176174
}
177175

178-
[HttpGet]
176+
[HttpGet("getallproductsjson")]
179177
public JsonResult GetAllProductsJson()
180178
{
181179
return new JsonResult(this.GetAllProducts());

0 commit comments

Comments
 (0)