Adding ability to update and delete items
This commit is contained in:
@@ -24,4 +24,28 @@ public class ItemControllerTests
|
||||
|
||||
Assert.IsType<BadRequestObjectResult>(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Update_ItemNotFound()
|
||||
{
|
||||
var svc = new Mock<ItemService>(config);
|
||||
svc.Setup(i => i.GetByIdAsync("id")).ReturnsAsync((Item?)null);
|
||||
var controller = new ItemController(svc.Object, new Mock<LocationService>(config).Object);
|
||||
|
||||
var result = await controller.Update("id", new UpdateItemRequest { LocationId="loc", Name="x" });
|
||||
|
||||
Assert.IsType<NotFoundObjectResult>(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Delete_NotFound()
|
||||
{
|
||||
var svc = new Mock<ItemService>(config);
|
||||
svc.Setup(i => i.GetByIdAsync("id")).ReturnsAsync((Item?)null);
|
||||
var controller = new ItemController(svc.Object, new Mock<LocationService>(config).Object);
|
||||
|
||||
var result = await controller.Delete("id");
|
||||
|
||||
Assert.IsType<NotFoundObjectResult>(result);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user