[InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid public void GetActive_IdNotValid(string id) { // Arrange var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService, fintoService, serviceAndChannelService, channelService, userService, logger); // Act Action act = () => controller.GetActive(id); // Assert act.ShouldThrow <Exception>(); }
public void GetActive_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.GetActive(strId); // Assert result.Should().BeOfType <NotFoundObjectResult>(); }
public void GetActive_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.GetActive(strId); // Assert var okResult = Assert.IsType <OkObjectResult>(result); Assert.IsAssignableFrom <VmOpenApiServiceVersionBase>(okResult.Value); }
public void GetActive_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.GetActive(null, pageNumber); // Assert var okResult = Assert.IsType <OkObjectResult>(result); var model = Assert.IsAssignableFrom <V3VmOpenApiGuidPage>(okResult.Value); Assert.Equal(pageNumber, model.PageNumber); }