コード例 #1
0
        public static IEnumerable <IMember> CreateMultipleSimpleMembers(IMemberType memberType, int amount, Action <int, IMember> onCreating = null)
        {
            var list = new List <IMember>();

            for (var i = 0; i < amount; i++)
            {
                var    name   = "Member No-" + i;
                Member member = new MemberBuilder()
                                .WithMemberType(memberType)
                                .WithName(name)
                                .WithEmail("test" + i + "@test.com")
                                .WithLogin("test" + i, "test" + i)
                                .AddPropertyData()
                                .WithKeyValue("title", name + " member" + i)
                                .WithKeyValue("bodyText", "Member profile" + i)
                                .WithKeyValue("author", "John Doe" + i)
                                .Done()
                                .Build();

                onCreating?.Invoke(i, member);

                list.Add(member);
            }

            return(list);
        }
コード例 #2
0
        public static IEnumerable <IMember> CreateSimpleMembers(IMemberType memberType, int amount)
        {
            var list = new List <IMember>();

            for (int i = 0; i < amount; i++)
            {
                var name = "Member No-" + i;

                MemberBuilder builder = new MemberBuilder()
                                        .WithMemberType(memberType)
                                        .WithName(name)
                                        .WithEmail("test" + i + "@test.com")
                                        .WithLogin("test" + i, "test" + i);

                builder = builder
                          .AddPropertyData()
                          .WithKeyValue("title", name + " member" + i)
                          .WithKeyValue("bodyText", "This is a subpage" + i)
                          .WithKeyValue("author", "John Doe" + i)
                          .Done();

                list.Add(builder.Build());
            }

            return(list);
        }
コード例 #3
0
        public static Member CreateSimpleMember(IMemberType memberType, string name, string email, string password, string username, Guid?key = null)
        {
            MemberBuilder builder = new MemberBuilder()
                                    .WithMemberType(memberType)
                                    .WithName(name)
                                    .WithEmail(email)
                                    .WithIsApproved(true)
                                    .WithLogin(username, password);

            if (key.HasValue)
            {
                builder = builder.WithKey(key.Value);
            }

            builder = builder
                      .AddPropertyData()
                      .WithKeyValue("title", name + " member")
                      .WithKeyValue("bodyText", "Member profile")
                      .WithKeyValue("author", "John Doe")
                      .Done();

            return(builder.Build());
        }