Exemple #1
0
        public void SutReturnsFields(DbFieldCollection sut, DbField field1, DbField field2)
        {
            sut.Add(field1);
            sut.Add(field2);

            sut.ShouldAllBeEquivalentTo(new[] { field1, field2 });
        }
Exemple #2
0
        public void TryGetValueReturnsTrueAndValue(DbFieldCollection sut, ID fieldId, string expected)
        {
            sut.Add(fieldId, expected);

            string value;

            sut.TryGetValue(fieldId, out value).Should().BeTrue();
            value.Should().Be(expected);
        }
        public void ShouldAddDbField()
        {
            // arrange
            var collection = new DbFieldCollection();

            // act
            collection.Add(new DbField("Title"));

            // assert
            collection.Count().Should().Be(1);
        }
    public void ShouldAddDbField()
    {
      // arrange
      var collection = new DbFieldCollection();

      // act
      collection.Add(new DbField("Title"));

      // assert
      collection.Count().Should().Be(1);
    }
Exemple #5
0
 public void AddFieldByNameGeneratesNewId(DbFieldCollection sut, string fieldName)
 {
     sut.Add(fieldName);
     sut.Single().ID.Should().NotBe(ID.Null);
 }
Exemple #6
0
 public void AddFieldByName(DbFieldCollection sut, string fieldName)
 {
     sut.Add(fieldName);
     sut.Single().Name.Should().Be(fieldName);
 }
Exemple #7
0
 public void AddField(DbFieldCollection sut, DbField field)
 {
     sut.Add(field);
     sut.Count().Should().Be(1);
 }
Exemple #8
0
 public void GetFieldById(DbFieldCollection sut, DbField field)
 {
     sut.Add(field);
     sut[field.ID].ShouldBeEquivalentTo(field);
 }
 public void AddFieldByNameAndValue(DbFieldCollection sut, string fieldName, string value)
 {
   sut.Add(fieldName, value);
   sut.Single().Value.Should().Be(value);
 }
 public void AddFieldByNameSetsEmptyValue(DbFieldCollection sut, string fieldName)
 {
   sut.Add(fieldName);
   sut.Single().Value.Should().BeEmpty();
 }
 public void AddFieldByNameGeneratesNewId(DbFieldCollection sut, string fieldName)
 {
   sut.Add(fieldName);
   sut.Single().ID.Should().NotBe(ID.Null);
 }
 public void AddFieldByName(DbFieldCollection sut, string fieldName)
 {
   sut.Add(fieldName);
   sut.Single().Name.Should().Be(fieldName);
 }
 public void AddField(DbFieldCollection sut, DbField field)
 {
   sut.Add(field);
   sut.Count().Should().Be(1);
 }
    public void TryGetValueReturnsTrueAndValue(DbFieldCollection sut, ID fieldId, string expected)
    {
      sut.Add(fieldId, expected);

      string value;
      sut.TryGetValue(fieldId, out value).Should().BeTrue();
      value.Should().Be(expected);
    }
Exemple #15
0
 public void AddFieldByNameSetsEmptyValue(DbFieldCollection sut, string fieldName)
 {
     sut.Add(fieldName);
     sut.Single().Value.Should().BeEmpty();
 }
Exemple #16
0
 public void AddFieldByNameAndValue(DbFieldCollection sut, string fieldName, string value)
 {
     sut.Add(fieldName, value);
     sut.Single().Value.Should().Be(value);
 }
 public void GetFieldById(DbFieldCollection sut, DbField field)
 {
   sut.Add(field);
   sut[field.ID].ShouldBeEquivalentTo(field);
 }
Exemple #18
0
 public void ContainsFieldIsTrueIfExists(DbFieldCollection sut, DbField field)
 {
     sut.Add(field);
     sut.ContainsKey(field.ID).Should().BeTrue();
 }
 public void ContainsFieldIsTrueIfExists(DbFieldCollection sut, DbField field)
 {
   sut.Add(field);
   sut.ContainsKey(field.ID).Should().BeTrue();
 }
    public void SutReturnsFields(DbFieldCollection sut, DbField field1, DbField field2)
    {
      sut.Add(field1);
      sut.Add(field2);

      sut.ShouldAllBeEquivalentTo(new[] { field1, field2 });
    }
Exemple #21
0
    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);
    }