예제 #1
0
        public void getFieldTest()
        {
            string name = "TEST_STATION_ENTITY";
            StationEntity se = new StationEntity(name);

            StationField sf1 = new StationField("Title");
            sf1.Level = (1);
            StationField sf2 = new StationField("CreateDate");
            sf2.Level = (1);
            StationField sf3 = new StationField("Detail");
            sf3.Level = (2);
            StationField sf4 = new StationField("UniqueId");

            se.AddField(sf1);
            se.AddField(sf2);
            se.AddField(sf3);
            se.AddField(sf4);

            // getField(String fieldName)
            Assert.AreEqual(2, se.GetField("Detail").Level);

            // getSummaryFields // level 1
            List<StationField> sflist = se.SummaryFields;
            Assert.AreEqual(2, sflist.Count);
            Assert.AreEqual("Title", sflist[0].Name);

            // getFields / Add / setFields then verify
            sflist = se.Fields;
            Assert.AreEqual(4, sflist.Count);
            sflist.Add(new StationField("Name"));
            se.Fields = (sflist);
            sflist = se.Fields;
            Assert.AreEqual(5, sflist.Count);
            Assert.AreEqual("Title", sflist[0].Name);
            Assert.AreEqual("Name", sflist[4].Name);
            sflist = se.SummaryFields;
            Assert.AreEqual(2, sflist.Count);
            Assert.AreEqual("Title", sflist[0].Name);
            Assert.AreEqual(1, sflist[1].Level);
        }
예제 #2
0
 private void setTestStationEntities()
 {
     List<StationEntity> list = new List<StationEntity>();
     StationEntity se = new StationEntity("TEST");
     StationField f = new StationField("field-one");
     f.Type = (Field.TextType);
     se.AddField(f);
     StationField f2 = new StationField("field-two");
     f2.Type = (Field.TextType);
     se.AddField(f2);
         list.Add(se);
         this.Entities = (list);
 }