예제 #1
0
        public void Put_ServiceNotExists()
        {
            // Arrange
            var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService,
                                                     fintoServiceMock.Object, serviceAndChannelService, channelServiceMockSetup.Object, userService, logger);

            // Act
            var result = controller.Put(strId, new V7VmOpenApiServiceInBase(), false);

            // Assert
            var notFoundResult = Assert.IsType <NotFoundObjectResult>(result);

            Assert.IsType <VmError>(notFoundResult.Value);
        }
예제 #2
0
        public void Put_RequestIsNull()
        {
            // Arrange
            var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService,
                                                     fintoServiceMock.Object, serviceAndChannelService, channelServiceMockSetup.Object, userService, logger);

            // Act
            var result = controller.Put(strId, null, false);

            // Assert
            var badResult = Assert.IsType <BadRequestObjectResult>(result);

            Assert.IsType <SerializableError>(badResult.Value);
        }
예제 #3
0
        public void Put_CurrentVersionNotFound()
        {
            // Arrange
            serviceServiceMockSetup.Setup(s => s.GetServiceByIdSimple(id, false)).Returns((VmOpenApiServiceVersionBase)null);
            var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService,
                                                     fintoServiceMock.Object, serviceAndChannelService, channelServiceMockSetup.Object, userService, logger);

            // Act
            var result = controller.Put(strId, new V7VmOpenApiServiceInBase(), false);

            // Assert
            var notFoundResult = Assert.IsType <NotFoundObjectResult>(result);

            Assert.IsType <VmError>(notFoundResult.Value);
        }
예제 #4
0
        public void Put_CanModifyService()
        {
            // Arrange
            serviceServiceMockSetup.Setup(s => s.GetServiceByIdSimple(It.IsAny <Guid>(), false))
            .Returns(new VmOpenApiServiceVersionBase {
                PublishingStatus = PublishingStatus.Published.ToString(), Security = new VmSecurityOwnOrganization {
                    IsOwnOrganization = true
                }
            });
            serviceServiceMockSetup.Setup(s => s.SaveService(It.IsAny <VmOpenApiServiceInVersionBase>(), It.IsAny <bool>(), defaultVersion, false, null))
            .Returns(new V7VmOpenApiService());
            var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService,
                                                     fintoServiceMock.Object, serviceAndChannelService, channelServiceMockSetup.Object, userService, logger);

            // Act
            var result = controller.Put(strId, new V7VmOpenApiServiceInBase(), false);

            // Assert
            var okResult = Assert.IsType <OkObjectResult>(result);

            Assert.IsType <V7VmOpenApiService>(okResult.Value);
        }