[InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid public void Get_IdNotValid(string id) { // Arrange var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService, fintoService, serviceAndChannelService, channelService, userService, logger); // Act Action act = () => controller.Get(id); // Assert act.ShouldThrow <Exception>(); }
public void Get_ServiceNotExists() { // Arrange serviceServiceMockSetup.Setup(s => s.GetServiceById(It.IsAny <Guid>(), defaultVersion, It.IsAny <VersionStatusEnum>())).Returns((VmOpenApiServiceVersionBase)null); var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService, fintoService, serviceAndChannelService, channelService, userService, logger); // Act var result = controller.Get(strId); // Assert result.Should().BeOfType <NotFoundObjectResult>(); }
public void Get_ServiceExists() { // Arrange serviceServiceMockSetup.Setup(s => s.GetServiceById(It.IsAny <Guid>(), defaultVersion, It.IsAny <VersionStatusEnum>())).Returns(new VmOpenApiServiceVersionBase()); var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService, fintoService, serviceAndChannelService, channelService, userService, logger); // Act var result = controller.Get(strId); // Assert var okResult = Assert.IsType <OkObjectResult>(result); Assert.IsAssignableFrom <VmOpenApiServiceVersionBase>(okResult.Value); }
public void Get_Services_CanCall() { // Arrange serviceServiceMockSetup.Setup(s => s.GetServices(null, pageNumber, It.IsAny <int>(), It.IsAny <bool>(), It.IsAny <bool>())) .Returns(new V3VmOpenApiGuidPage(pageNumber, pageSize)); var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService, fintoService, serviceAndChannelService, channelService, userService, logger); // Act var result = controller.Get(null, pageNumber); // Assert var okResult = Assert.IsType <OkObjectResult>(result); var model = Assert.IsAssignableFrom <V3VmOpenApiGuidPage>(okResult.Value); Assert.Equal(pageNumber, model.PageNumber); }