コード例 #1
0
 /// <summary>
 /// 获取版本列表
 /// </summary>
 /// <returns></returns>
 private async Task GetEditions()
 {
     await SetBusyAsync(async() =>
     {
         await WebRequest.Execute(() => appService.GetEditions(),
                                  async result =>
         {
             dataPager.SetList(new PagedResultDto <EditionListDto>()
             {
                 Items = result.Items
             });
             await Task.CompletedTask;
         });
     });
 }
コード例 #2
0
        /// <summary>
        /// 获取筛选版本列表
        /// </summary>
        /// <returns></returns>
        public async Task GetAllEditions()
        {
            if (Editions.Count > 0)
            {
                return;
            }

            await WebRequest.Execute(() => editionAppService.GetEditions(),
                                     async result =>
            {
                Editions.Clear();
                foreach (var item in Map <List <EditionListModel> >(result.Items))
                {
                    Editions.Add(item);
                }

                await Task.CompletedTask;
            });
        }
コード例 #3
0
        public async Task Should_Not_Create_User_More_Than_Allowed_Count()
        {
            //Getting edition for edit
            var output = await _editionAppService.GetEditionForEdit(new NullableIdDto(null));

            //Changing a sample feature value
            var maxUserCountFeature = output.FeatureValues.FirstOrDefault(f => f.Name == AppFeatures.MaxUserCount);

            if (maxUserCountFeature != null)
            {
                maxUserCountFeature.Value = "2";
            }

            await _editionAppService.CreateEdition(
                new CreateEditionDto
            {
                Edition = new EditionCreateDto
                {
                    DisplayName = "Premium Edition"
                },
                FeatureValues = output.FeatureValues
            });


            var premiumEditon = (await _editionAppService.GetEditions()).Items.FirstOrDefault(e => e.DisplayName == "Premium Edition");

            premiumEditon.ShouldNotBeNull();

            await UsingDbContextAsync(async context =>
            {
                var tenant       = await context.Tenants.SingleAsync(t => t.TenancyName == AbpTenantBase.DefaultTenantName);
                tenant.EditionId = premiumEditon.Id;

                context.SaveChanges();
            });

            LoginAsDefaultTenantAdmin();

            // This is second user (first is tenant admin)
            await _userAppService.CreateOrUpdateUser(
                new CreateOrUpdateUserInput
            {
                User = new UserEditDto
                {
                    EmailAddress = "*****@*****.**",
                    Name         = "John",
                    Surname      = "Nash",
                    UserName     = "******",
                    Password     = "******"
                },
                AssignedRoleNames = new string[] { }
            });

            //Act
            var exception = await Assert.ThrowsAsync <UserFriendlyException>(
                async() =>
                await _userAppService.CreateOrUpdateUser(
                    new CreateOrUpdateUserInput
            {
                User = new UserEditDto
                {
                    EmailAddress = "*****@*****.**",
                    Name         = "Ali Rıza",
                    Surname      = "Adıyahşi",
                    UserName     = "******",
                    Password     = "******"
                },
                AssignedRoleNames = new string[] { }
            })
                );

            exception.Message.ShouldContain(_localizationManager.GetString(ERPConsts.LocalizationSourceName, "MaximumUserCount_Error_Message"));
        }
        public async Task Should_Get_Editions()
        {
            var editions = await _editionAppService.GetEditions();

            editions.Items.Count.ShouldBeGreaterThan(0);
        }