public void TestingNewTenantApiContract_GettingSettingProperties_ShouldPass() { var newTenantApiContract = new NewTenantContract { Name = "Test tenant", Alias = "test-tenant" }; Assert.Equal("Test tenant", newTenantApiContract.Name); Assert.Equal("test-tenant", newTenantApiContract.Alias); newTenantApiContract.Name = "Test tenant 111"; Assert.Equal("Test tenant 111", newTenantApiContract.Name); newTenantApiContract.Alias = "test-tenant-111"; Assert.Equal("test-tenant-111", newTenantApiContract.Alias); }
public async Task <IActionResult> Create(NewTenantContract newTenantContract) { if (newTenantContract == null) { _logger.LogWarning(LoggingEvents.CreateItemBadData, "Empty tenant cannot be created"); return(BadRequest()); } try { _logger.LogInformation(LoggingEvents.CreateItem, "Creating new tenant with name {Name}", newTenantContract.Name); var newTenant = _mapper.Map <Tenant>(newTenantContract); newTenant.Guid = await _tenantLogic.Create(newTenant); return(Ok(newTenant.Guid)); } catch (BasicWebAppException ex) { ExceptionProcessor.Process(LoggingEvents.CreateItemFailed, _logger, ex, newTenantContract.Name); } return(StatusCode(StatusCodes.Status500InternalServerError)); }