public async void PutReturnValidResponseIfPartnerNotFoundDueToIdMismatchTest() { var controller = new PartnerController(partnerService, mapper, appSettings); var response = await controller.Put(5, new UpdatePartnerViewModel() { Id = 4 }); var notFoundResult = response as NotFoundObjectResult; Assert.NotNull(notFoundResult); Assert.Equal(404, notFoundResult.StatusCode); }
public async void PutTest() { var controller = new PartnerController(partnerService, mapper, appSettings); var model = new UpdatePartnerViewModel() { Id = 1, Name = "Amazon", }; var response = await controller.Put(1, model); var okResult = response as OkObjectResult; Assert.NotNull(okResult); Assert.Equal(200, okResult.StatusCode); Assert.NotNull(okResult.Value); var partner = okResult.Value as Partner; Assert.Equal(model.Name, partner.Name); }