public void CreateApplicationType_Invalid_TenantId_Or_AppName() { // Arrange ApplicationType applicationType = new ApplicationType { AppTypeName = "" }; int tenantId = 0; // Act var controller = new ApplicationController(logger.Object, applicationServiceMoq.Object); var response = controller.CreateApplicationType(applicationType, tenantId) as BadRequestObjectResult; // Assert Assert.IsType <BadRequestObjectResult>(response); Assert.Equal($"Empty Application name : {applicationType} Or invalid tenantId : {tenantId}", response.Value); }
public void CreateApplicationType_Failure() { // Arrange ApplicationType applicationType = new ApplicationType { AppTypeName = "Server" }; int tenantId = 1; int appCreatedInt = 0; applicationServiceMoq.Setup(c => c.CreateCustomApplicationType(applicationType, tenantId)).Returns(appCreatedInt); // Act var controller = new ApplicationController(logger.Object, applicationServiceMoq.Object); var response = controller.CreateApplicationType(applicationType, tenantId) as BadRequestObjectResult; // Assert Assert.IsType <BadRequestObjectResult>(response); Assert.Equal("Application Type Not created", response.Value); applicationServiceMoq.Verify(c => c.CreateCustomApplicationType(applicationType, tenantId), Times.Once); }