protected void Add(DbField field, string standardValue) { this.Fields.Add(field); var standardValueField = new DbField(field.Name) { ID = field.ID, Value = standardValue }; this.StandardValues.Add(standardValueField); }
public void GetFieldsToEdit_ItemHasFields_ReturnFields(Db db, DbItem item, DbField field1, DbField field2) { item.Add(field1); item.Add(field2); db.Add(item); var testItem = db.GetItem(item.ID); var expectedResult = new [] {field1.Name + "|" + field2.Name, field2.Name + "|" + field1.Name}; GetFieldsToEditService.GetFieldsToEdit(testItem).Should().BeOneOf(expectedResult); }
public new void Add(ID id, string standardValue) { var field = new DbField(id); this.Add(field, standardValue); }
public new void Add(string fieldName, string standardValue) { var field = new DbField(fieldName); this.Add(field, standardValue); }
public void HasFieldValue_FieldDoesNotExist_ShouldReturnFalse(Db db, DbItem item, DbField field) { //Arrange db.Add(item); var testItem = db.GetItem(item.ID); //Act testItem.FieldHasValue(field.ID).Should().BeFalse(); }
public void HasFieldValue_FieldIsNull_ShouldReturnFalse(Db db, DbItem item, DbField field) { //Arrange field.Value = null; item.Add(field); db.Add(item); var testItem = db.GetItem(item.ID); //Act testItem.FieldHasValue(field.ID).Should().BeFalse(); }
public void HasFieldValue_FieldHasValue_ShouldReturnTrue(Db db, DbItem item, DbField field, string value) { //Arrange field.Value = value; item.Add(field); db.Add(item); var testItem = db.GetItem(item.ID); //Act testItem.FieldHasValue(field.ID).Should().BeTrue(); }
/// <summary> /// Adds a new <see cref="DbField"/> to the item. /// </summary> /// <param name="field">The field.</param> public void Add(DbField field) { Assert.ArgumentNotNull(field, "field"); this.Fields.Add(field); }
public void Add(DbField field) { this.Fields.Add(field); }
/// <summary> /// Adds a specific field with a Standard Value. /// </summary> /// <param name="field">The field.</param> /// <param name="standardValue">The field standard value.</param> public void Add(DbField field, string standardValue) { this.Fields.Add(field); var standardValueField = new DbField(field.Name, field.ID) { Shared = field.Shared, Source = field.Source, Type = field.Type, Value = standardValue }; this.StandardValues.Add(standardValueField); }
public void Add(string fieldName, string standardValue) { var field = new DbField(fieldName) { ID = ID.NewID }; this.Add(field, standardValue); }
protected virtual void CreateTemplate(DbItem item) { var isResolved = this.ResolveTemplate(item); if (isResolved) { return; } if (!ID.IsNullOrEmpty(item.TemplateID) && this.DataStorage.GetFakeTemplate(item.TemplateID) != null) { return; } if (item.TemplateID == ID.Null) { item.TemplateID = ID.NewID; } var fields = new DbFieldCollection(); foreach (var itemField in item.Fields) { var templatefield = new DbField(itemField.Name) { ID = itemField.ID }; fields.Add(templatefield); } var template = new DbTemplate(item.Name, item.TemplateID, fields); this.Add(template); }