public virtual async Task CreateAsync_UpdateAsync_DelteAsync_Test() { var tenant1 = await _tenantRepository.FindByNameAsync("tenant1"); var tenant2 = await _tenantRepository.FindByNameAsync("tenant2"); var id = await _mapTenantAppService.CreateAsync(new CreateMapTenantDto("100", tenant1.Id, "200")); var mapTenant1 = await _mapTenantAppService.GetAsync(id); var mapTenant1_2 = await _mapTenantAppService.FindByCodeAsync("100"); var mapTenant1_3 = await _mapTenantAppService.FindByMapCodeAsync("200"); Assert.Equal(mapTenant1.Code, mapTenant1_2.Code); Assert.Equal(mapTenant1.TenantId, mapTenant1_2.TenantId); Assert.Equal(mapTenant1.MapCode, mapTenant1_2.MapCode); Assert.Equal("200", mapTenant1.MapCode); Assert.Equal(mapTenant1.Code, mapTenant1_3.Code); Assert.Equal(mapTenant1.TenantId, mapTenant1_3.TenantId); Assert.Equal(mapTenant1.MapCode, mapTenant1_3.MapCode); await _mapTenantAppService.UpdateAsync(id, new UpdateMapTenantDto("300", tenant1.Id, "400")); var mapTenant2 = await _mapTenantAppService.FindByCodeAsync("300"); var mapTenant2_2 = await _mapTenantAppService.FindByMapCodeAsync("400"); Assert.Equal("300", mapTenant2.Code); Assert.Equal("400", mapTenant2.MapCode); Assert.Equal(tenant1.Id, mapTenant2.TenantId); Assert.Equal(mapTenant2.Code, mapTenant2_2.Code); Assert.Equal(mapTenant2.MapCode, mapTenant2_2.MapCode); Assert.Equal(tenant1.Id, mapTenant2_2.TenantId); //Update code await _mapTenantAppService.UpdateAsync(id, new UpdateMapTenantDto("300", tenant2.Id, "500")); var mapTenant3 = await _mapTenantAppService.GetAsync(id); await Assert.ThrowsAsync <AbpException>(() => { return(_mapTenantAppService.CreateAsync(new CreateMapTenantDto("3001", tenant2.Id, "500"))); }); var mapTenancyConfiguration = await _mapTenancyConfigurationProvider.GetAsync("300"); Assert.Equal(mapTenancyConfiguration.TenantId, tenant2.Id); await _mapTenantAppService.DeleteAsync(id); var mapTenant5 = await _mapTenantAppService.FindByCodeAsync("300"); Assert.Null(mapTenant5); }
public virtual async Task CreateAsync_UpdateAsync_DelteAsync_Test() { var tenantId = new Guid("42645233-3d72-4339-9adc-845321f8ada3"); var tenantId2 = new Guid("42645244-3d72-4339-9adc-845321f8ada3"); var id = await _mapTenantAppService.CreateAsync(new CreateMapTenantDto("100", tenantId, "200")); var mapTenant1 = await _mapTenantAppService.GetAsync(id); var mapTenant2 = await _mapTenantAppService.GetByCodeAsync("100"); Assert.Equal(mapTenant1.Code, mapTenant2.Code); Assert.Equal(mapTenant1.TenantId, mapTenant2.TenantId); Assert.Equal(mapTenant1.MapCode, mapTenant2.MapCode); Assert.Equal("200", mapTenant1.MapCode); await _mapTenantAppService.UpdateAsync(new UpdateMapTenantDto(id, "300", tenantId2, "400")); var mapTenant3 = await _mapTenantAppService.GetByCodeAsync("300"); Assert.Equal("300", mapTenant3.Code); Assert.Equal("400", mapTenant3.MapCode); Assert.Equal(tenantId2, mapTenant3.TenantId); var mapTenancyConfiguration = await _mapTenancyConfigurationProvider.GetAsync("300"); Assert.Equal(mapTenancyConfiguration.TenantId, tenantId2); await _mapTenantAppService.DeleteAsync(id); var mapTenant4 = await _mapTenantAppService.GetByCodeAsync("300"); Assert.Null(mapTenant4); }
public async Task <MapTenantDto> GetAsync(Guid id) { return(await _mapTenantAppService.GetAsync(id)); }