public void PutServiceAndChannelBySource_ModelIsValid() { // Arrange var serviceSourceId = "serviceSourceId"; var request = new V7VmOpenApiServiceAndChannelRelationBySourceInBase(); serviceAndChannelServiceMockSetup.Setup(s => s.SaveServiceConnectionsBySource(serviceSourceId, It.IsAny <V7VmOpenApiServiceAndChannelRelationBySourceAsti>(), defaultVersion)) .Returns(new VmOpenApiServiceVersionBase()); var controller = new V7ConnectionController(serviceAndChannelServiceMockSetup.Object, serviceService, channelService, userService, settings, logger); // Act var result = controller.PutServiceAndChannelBySource(serviceSourceId, request); // Assert var okResult = Assert.IsType <OkObjectResult>(result); Assert.IsAssignableFrom <VmOpenApiServiceVersionBase>(okResult.Value); }
public IActionResult PutServiceAndChannelBySource(string serviceSourceId, [FromBody] V7VmOpenApiServiceAndChannelRelationBySourceInBase request) { return(PutServiceConnectionsBySourceBase(serviceSourceId, request)); }
/// <summary> /// Post service and channel relationship. This is for regular connections. /// </summary> /// <param name="serviceSourceId">External source identifier for service</param> /// <param name="request"></param> /// <returns></returns> protected virtual IActionResult PutServiceConnectionsBySourceBase(string serviceSourceId, V7VmOpenApiServiceAndChannelRelationBySourceInBase request) { if (request == null) { ModelState.AddModelError("RequestIsNull", CoreMessages.OpenApi.RequestIsNull); return(new BadRequestObjectResult(ModelState)); } return(PutServiceConnectionsBySourceBaseCommon(serviceSourceId, request.ConvertToLatestVersion())); }