コード例 #1
0
        public void PutBySource_CanModifyService()
        {
            // Arrange
            var sourdeId = "sourceId";

            serviceServiceMockSetup.Setup(s => s.GetServiceBySource(sourdeId))
            .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, sourdeId))
            .Returns(new V7VmOpenApiService());
            var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService,
                                                     fintoServiceMock.Object, serviceAndChannelService, channelServiceMockSetup.Object, userService, logger);

            // Act
            var result = controller.PutBySource(sourdeId, new V7VmOpenApiServiceInBase(), false);

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

            Assert.IsType <V7VmOpenApiService>(okResult.Value);
        }
コード例 #2
0
        public void PutBySource_SourceIdNotValid(string sourceId)
        {
            // Arrange
            var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService,
                                                     fintoServiceMock.Object, serviceAndChannelService, channelServiceMockSetup.Object, userService, logger);

            // Act
            var result = controller.PutBySource(sourceId, new V7VmOpenApiServiceInBase(), false);

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

            Assert.IsType <VmError>(notFoundResult.Value);
        }
コード例 #3
0
        public void PutBySource_RequestIsNull()
        {
            // Arrange
            var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService,
                                                     fintoServiceMock.Object, serviceAndChannelService, channelServiceMockSetup.Object, userService, logger);

            // Act
            var result = controller.PutBySource("sourceId", null, false);

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

            Assert.IsType <SerializableError>(badResult.Value);
        }
コード例 #4
0
        public void PutBySource_SourceIdNotFound()
        {
            // Arrange
            var sourdeId = "sourceId";

            serviceServiceMockSetup.Setup(s => s.GetServiceBySource(sourdeId)).Returns((VmOpenApiServiceVersionBase)null);
            var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService,
                                                     fintoServiceMock.Object, serviceAndChannelService, channelServiceMockSetup.Object, userService, logger);

            // Act
            var result = controller.PutBySource(sourdeId, new V7VmOpenApiServiceInBase(), false);

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

            Assert.IsType <VmError>(notFoundResult.Value);
        }