/// <summary> /// Gets the properties and attributes for the entity /// </summary> /// <param name="stepTypeId">The step type identifier.</param> /// <returns></returns> private List <EntityField> GetStepAttributes(int?stepTypeId) { List <EntityField> entityAttributeFields = new List <EntityField>(); if (stepTypeId.HasValue) { var fakeStep = new Rock.Model.Step { StepTypeId = stepTypeId.Value }; Rock.Attribute.Helper.LoadAttributes(fakeStep); var attributeList = fakeStep.Attributes.Select(a => a.Value).ToList(); EntityHelper.AddEntityFieldsForAttributeList(entityAttributeFields, attributeList); } int index = 0; var sortedFields = new List <EntityField>(); foreach (var entityProperty in entityAttributeFields.OrderBy(p => p.TitleWithoutQualifier).ThenBy(p => p.Name)) { entityProperty.Index = index; index++; sortedFields.Add(entityProperty); } return(sortedFields); }
public void StepEndDateKeyGetsWorksWithNullValue() { var step = new Rock.Model.Step(); step.EndDateTime = null; Assert.IsNull(step.EndDateKey); }
public void StepStartDateKeyWorksWithNullValue() { var step = new Rock.Model.Step(); step.StartDateTime = null; Assert.IsNull(step.StartDateKey); }
public void StepEndDateKeyGetsSetCorrectly() { var testList = TestDataHelper.GetAnalyticsSourceDateTestData(); foreach (var keyValue in testList) { var step = new Rock.Model.Step(); step.EndDateTime = keyValue.Value; Assert.AreEqual(keyValue.Key, step.EndDateKey); } }
private Rock.Model.Step BuildStep(RockContext rockContext, DateTime completeDateTime, DateTime startDateTime, DateTime endDateTime) { var stepType = new StepTypeService(rockContext).Queryable().First(); var personAlias = new PersonAliasService(rockContext).Queryable().First(); var step = new Rock.Model.Step(); step.StepTypeId = stepType.Id; step.PersonAliasId = personAlias.Id; step.ForeignKey = stepForiegnKey; step.CompletedDateTime = completeDateTime; step.StartDateTime = startDateTime; step.EndDateTime = endDateTime; return(step); }