本文整理汇总了C#中Place.Create方法的典型用法代码示例。如果您正苦于以下问题:C# Place.Create方法的具体用法?C# Place.Create怎么用?C# Place.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Place
的用法示例。
在下文中一共展示了Place.Create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestExistsForCgndbKey
public void TestExistsForCgndbKey()
{
string cgndbKey = "ABCDE";
Place place = new Place();
place.CgndbKey = cgndbKey;
place.Create();
Watershed watershed = new Watershed();
watershed.DrainageCode = "01-02-03-04-05-06";
watershed.Place = place;
watershed.Create();
Flush();
Assert.IsTrue(Watershed.ExistsForCgndbKey(cgndbKey));
}
示例2: TestFindAllByQuery
public void TestFindAllByQuery()
{
string[] placeNames = { "Saint", "Saint John", "Saint John River",
"Hammond River", "Fredericton", "Moncton", "Miramichi River" };
for(int i=0; i < placeNames.Length; i++)
{
Place place = new Place();
place.Name = placeNames[i];
// XXX: this is technically not a valid CGNDB Key but no validation is performed
place.CgndbKey = i.ToString();
place.Create();
}
Flush();
Assert.AreEqual(3, Place.FindAllByQuery("Saint").Count, "Query for 'Saint'");
Assert.AreEqual(3, Place.FindAllByQuery("saint").Count, "Query for 'saint'");
Assert.AreEqual(1, Place.FindAllByQuery("Fredericton").Count, "Query for 'Fredericton'");
Assert.AreEqual(2, Place.FindAllByQuery("M").Count, "Query for 'M' returned");
Assert.AreEqual(0, Place.FindAllByQuery("John").Count, "Query for 'John'");
Assert.AreEqual(0, Place.FindAllByQuery("River").Count, "Query for 'River'");
Assert.AreEqual(3, Place.FindAllByQuery(" Saint").Count, "Query for ' Saint'");
Assert.AreEqual(1, Place.FindAllByQuery("Hammond River ").Count, "Query for 'Hammond River '");
}
示例3: TestExistsForCgndbKeyOrAltCgndbKeyWhenWaterbodyHasAltCgndbKey
public void TestExistsForCgndbKeyOrAltCgndbKeyWhenWaterbodyHasAltCgndbKey()
{
string altCgndbKey = "ABCDE";
Place place = new Place();
place.CgndbKey = altCgndbKey;
place.Create();
WaterBody waterbody = new WaterBody();
waterbody.AltPlace = place;
waterbody.Create();
Flush();
Assert.IsTrue(WaterBody.ExistsForCgndbKeyOrAltCgndbKey(altCgndbKey));
}
示例4: TestFindByCgndbKey
public void TestFindByCgndbKey()
{
string cgndbKey = "ABCDE";
Place place = new Place();
place.CgndbKey = cgndbKey;
place.Create();
Watershed watershed = new Watershed();
watershed.DrainageCode = "01-02-03-04-05-06";
watershed.Place = place;
watershed.Create();
Flush();
Watershed foundWatershed = Watershed.FindByCgndbKey(cgndbKey);
Assert.AreEqual(watershed, foundWatershed);
Assert.AreEqual(place, foundWatershed.Place);
}
示例5: TestFindByCgndbKeyOrAltCgndbKeyWhenWaterbodyHasCgndbKey
public void TestFindByCgndbKeyOrAltCgndbKeyWhenWaterbodyHasCgndbKey()
{
string cgndbKey = "ABCDE";
Place place = new Place();
place.CgndbKey = cgndbKey;
place.Create();
WaterBody waterbody = new WaterBody();
waterbody.Place = place;
waterbody.Create();
Flush();
WaterBody foundWaterbody = WaterBody.FindByCgndbKeyOrAltCgndbKey(cgndbKey);
Assert.AreEqual(waterbody, foundWaterbody);
Assert.AreEqual(place, foundWaterbody.Place);
}