Ejemplo n.º 1
0
 /// <summary>
 /// 删除语言
 /// </summary>
 private async void Delete()
 {
     if (await dialog.Question(Local.Localize("LanguageDeleteWarningMessage", SelectedItem.DisplayName)))
     {
         await SetBusyAsync(async() =>
         {
             await WebRequest.Execute(() => appService.DeleteLanguage(
                                          new EntityDto(SelectedItem.Id)),
                                      RefreshAsync);
         });
     }
 }
        public async Task Delete_Language()
        {
            //Arrange
            var currentLanguages = await _languageManager.GetLanguagesAsync(AbpSession.TenantId);

            var randomLanguage = RandomHelper.GetRandomOf(currentLanguages.ToArray());

            //Act
            await _languageAppService.DeleteLanguage(new EntityDto(randomLanguage.Id));

            //Assert
            currentLanguages = await _languageManager.GetLanguagesAsync(AbpSession.TenantId);

            currentLanguages.Any(l => l.Name == randomLanguage.Name).ShouldBeFalse();
        }
        public async Task Delete_Language()
        {
            //Arrange
            System.Collections.Generic.IReadOnlyList <ApplicationLanguage> currentLanguages = await _languageManager.GetLanguagesAsync(AbpSession.TenantId);

            ApplicationLanguage randomLanguage = RandomHelper.GetRandomOf(currentLanguages.ToArray());

            //Act
            await _languageAppService.DeleteLanguage(new EntityDto(randomLanguage.Id));

            //Assert
            currentLanguages = await _languageManager.GetLanguagesAsync(AbpSession.TenantId);

            currentLanguages.Any(l => l.Name == randomLanguage.Name).ShouldBeFalse();
        }