public async Task Create_Language() { //Act var output = await _languageAppService.GetLanguageForEdit(new NullableIdDto(null)); //Assert output.Language.Id.ShouldBeNull(); output.LanguageNames.Count.ShouldBeGreaterThan(0); output.Flags.Count.ShouldBeGreaterThan(0); //Arrange var currentLanguages = await _languageManager.GetLanguagesAsync(AbpSession.TenantId); var nonRegisteredLanguages = output.LanguageNames.Where(l => currentLanguages.All(cl => cl.Name != l.Value)).ToList(); //Act var newLanguageName = nonRegisteredLanguages[RandomHelper.GetRandom(nonRegisteredLanguages.Count)].Value; await _languageAppService.CreateOrUpdateLanguage( new CreateOrUpdateLanguageInput { Language = new ApplicationLanguageEditDto { Icon = output.Flags[RandomHelper.GetRandom(output.Flags.Count)].Value, Name = newLanguageName } }); //Assert currentLanguages = await _languageManager.GetLanguagesAsync(AbpSession.TenantId); currentLanguages.Count(l => l.Name == newLanguageName).ShouldBe(1); }
protected override async void Save() { await SetBusyAsync(async() => { await WebRequest.Execute(() => appService.CreateOrUpdateLanguage(new CreateOrUpdateLanguageInput() { Language = language }), async() => { base.Save(); await Task.CompletedTask; }); }); }