public override ContentItemSave Build() { var id = _id ?? 0; var parentId = _parentId ?? -1; var contentTypeAlias = _contentTypeAlias ?? null; ContentSaveAction action = _action ?? ContentSaveAction.Save; IEnumerable <ContentVariantSave> variants = _variantBuilders.Select(x => x.Build()); return(new TestContentItemSave() { Id = id, ParentId = parentId, ContentTypeAlias = contentTypeAlias, Action = action, Variants = variants, }); }
/// <summary> /// Setup all standard member data for test /// </summary> private Member SetupMemberTestData( out MemberSave fakeMemberData, out MemberDisplay memberDisplay, ContentSaveAction contentAction) { // arrange MemberType memberType = MemberTypeBuilder.CreateSimpleMemberType(); Member member = MemberBuilder.CreateSimpleMember(memberType, "Test Member", "*****@*****.**", "123", "test"); var memberId = 123; member.Id = memberId; // TODO: replace with builder for MemberSave and MemberDisplay fakeMemberData = new MemberSave() { Id = memberId, SortOrder = member.SortOrder, ContentTypeId = memberType.Id, Key = member.Key, Password = new ChangingPasswordModel() { Id = 456, NewPassword = member.RawPasswordValue, OldPassword = null }, Name = member.Name, Email = member.Email, Username = member.Username, PersistedContent = member, PropertyCollectionDto = new ContentPropertyCollectionDto() { }, Groups = new List <string>(), //Alias = "fakeAlias", ContentTypeAlias = member.ContentTypeAlias, Action = contentAction, Icon = "icon-document", Path = member.Path }; memberDisplay = new MemberDisplay() { Id = memberId, SortOrder = member.SortOrder, ContentTypeId = memberType.Id, Key = member.Key, Name = member.Name, Email = member.Email, Username = member.Username, //Alias = "fakeAlias", ContentTypeAlias = member.ContentTypeAlias, ContentType = new ContentTypeBasic(), ContentTypeName = member.ContentType.Name, Icon = fakeMemberData.Icon, Path = member.Path, Tabs = new List <Tab <ContentPropertyDisplay> >() { new Tab <ContentPropertyDisplay>() { Alias = "test", Id = 77, Properties = new List <ContentPropertyDisplay>() { new ContentPropertyDisplay() { Alias = "_umb_id", View = "idwithguid", Value = new [] { "123", "guid" } }, new ContentPropertyDisplay() { Alias = "_umb_doctype" }, new ContentPropertyDisplay() { Alias = "_umb_login" }, new ContentPropertyDisplay() { Alias = "_umb_email" }, new ContentPropertyDisplay() { Alias = "_umb_password" }, new ContentPropertyDisplay() { Alias = "_umb_membergroup" } } } } }; return(member); }
/// <summary> /// Returns true if the action passed in means we need to create something new /// </summary> /// <param name="action"></param> /// <returns></returns> internal static bool IsCreatingAction(ContentSaveAction action) { return(action.ToString().EndsWith("New")); }
/// <summary> /// Setup all standard member data for test /// </summary> private Member SetupMemberTestData( out MemberSave fakeMemberData, out MemberDisplay memberDisplay, ContentSaveAction contentAction) { // arrange var memberType = MemberTypeBuilder.CreateSimpleMemberType(); var member = MemberBuilder.CreateSimpleMember(memberType, "Test Member", "*****@*****.**", "123", "test"); var memberId = 123; member.Id = memberId; // TODO: replace with builder for MemberSave and MemberDisplay fakeMemberData = new MemberSave { Id = memberId, SortOrder = member.SortOrder, ContentTypeId = memberType.Id, Key = member.Key, Password = new ChangingPasswordModel { Id = 456, NewPassword = member.RawPasswordValue, OldPassword = null }, Name = member.Name, Email = member.Email, Username = member.Username, PersistedContent = member, PropertyCollectionDto = new ContentPropertyCollectionDto(), Groups = new List <string>(), // Alias = "fakeAlias", ContentTypeAlias = member.ContentTypeAlias, Action = contentAction, Icon = "icon-document", Path = member.Path, }; memberDisplay = new MemberDisplay { Id = memberId, SortOrder = member.SortOrder, ContentTypeId = memberType.Id, Key = member.Key, Name = member.Name, Email = member.Email, Username = member.Username, // Alias = "fakeAlias", ContentTypeAlias = member.ContentTypeAlias, ContentType = new ContentTypeBasic(), ContentTypeName = member.ContentType.Name, Icon = fakeMemberData.Icon, Path = member.Path, Tabs = new List <Tab <ContentPropertyDisplay> > { new() { Alias = "test", Id = 77, Properties = new List <ContentPropertyDisplay> { new() { Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}login" }, new() { Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}email" }, new() { Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}password", }, new() { Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}membergroup", }, new() { Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}failedPasswordAttempts", }, new() { Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}approved", }, new() { Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}lockedOut", }, new() { Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}lastLockoutDate", }, new() { Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}lastLoginDate", }, new() { Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}lastPasswordChangeDate", }, }, }, }, }; return(member); }