Example #1
0
        [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid
        public void GetByServiceChannel_ChannelIdNotValid(string id)
        {
            // Arrange
            var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService,
                                                     fintoService, serviceAndChannelService, channelService, userService, logger);

            // Act
            Action act = () => controller.GetByServiceChannel(id, null, pageNumber);

            // Assert
            act.ShouldThrow <Exception>();
        }
Example #2
0
        public void GetByServiceChannel_ChannelNotExists()
        {
            // Arrange
            channelServiceMockSetup.Setup(s => s.ChannelExists(id)).Returns(false);
            var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService,
                                                     fintoService, serviceAndChannelService, channelServiceMockSetup.Object, userService, logger);

            // Act
            var result = controller.GetByServiceChannel(strId, null, pageNumber);

            // Assert
            result.Should().BeOfType <NotFoundObjectResult>();
        }
Example #3
0
        public void GetByServiceChannel_ChannelExists()
        {
            // Arrange
            channelServiceMockSetup.Setup(s => s.ChannelExists(id)).Returns(true);
            serviceServiceMockSetup.Setup(s => s.GetServicesByServiceChannel(id, null, pageNumber, pageSize))
            .Returns(new V3VmOpenApiGuidPage(pageNumber, pageSize));
            var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService,
                                                     fintoService, serviceAndChannelService, channelServiceMockSetup.Object, userService, logger);

            // Act
            var result = controller.GetByServiceChannel(strId, null, pageNumber);

            // Assert
            var okResult = Assert.IsType <OkObjectResult>(result);
            var model    = Assert.IsAssignableFrom <V3VmOpenApiGuidPage>(okResult.Value);

            Assert.Equal(pageNumber, model.PageNumber);
        }