本文整理汇总了C#中TestObj类的典型用法代码示例。如果您正苦于以下问题:C# TestObj类的具体用法?C# TestObj怎么用?C# TestObj使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestObj类属于命名空间,在下文中一共展示了TestObj类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static int Main()
{
TestObj
obj
=
new
TestObj
();
TestObj
clone;
if
(sbah
+
obj.bah
+
obj.amethod
()
!=
8)
return
1;
clone
=
(TestObj)obj.MemberwiseClone
();
if
(clone.boh
!=
2)
return
1;
return
0;
}
示例2: Collate
public void Collate()
{
var obj = new TestObj
{
CollateDefault = "Alpha ",
CollateBinary = "Alpha ",
CollateRTrim = "Alpha ",
CollateNoCase = "Alpha ",
};
var db = new TestDb(new SQLitePlatformTest(), TestPath.GetTempFileName());
db.Insert(obj);
Assert.AreEqual(1, (from o in db.Table<TestObj>() where o.CollateDefault == "Alpha " select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateDefault == "ALPHA " select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateDefault == "Alpha" select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateDefault == "ALPHA" select o).Count());
Assert.AreEqual(1, (from o in db.Table<TestObj>() where o.CollateBinary == "Alpha " select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateBinary == "ALPHA " select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateBinary == "Alpha" select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateBinary == "ALPHA" select o).Count());
Assert.AreEqual(1, (from o in db.Table<TestObj>() where o.CollateRTrim == "Alpha " select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateRTrim == "ALPHA " select o).Count());
Assert.AreEqual(1, (from o in db.Table<TestObj>() where o.CollateRTrim == "Alpha" select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateRTrim == "ALPHA" select o).Count());
Assert.AreEqual(1, (from o in db.Table<TestObj>() where o.CollateNoCase == "Alpha " select o).Count());
Assert.AreEqual(1, (from o in db.Table<TestObj>() where o.CollateNoCase == "ALPHA " select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateNoCase == "Alpha" select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateNoCase == "ALPHA" select o).Count());
}
示例3: Collate
public void Collate()
{
var obj = new TestObj
{
CollateDefault = "Alpha ",
CollateBinary = "Alpha ",
CollateRTrim = "Alpha ",
CollateNoCase = "Alpha ",
};
var db = new OrmTestSession();
db.CreateTable<TestObj>();
db.Insert(obj);
Assert.AreEqual(1, (from o in db.Table<TestObj>() where o.CollateDefault == "Alpha " select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateDefault == "ALPHA " select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateDefault == "Alpha" select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateDefault == "ALPHA" select o).Count());
Assert.AreEqual(1, (from o in db.Table<TestObj>() where o.CollateBinary == "Alpha " select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateBinary == "ALPHA " select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateBinary == "Alpha" select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateBinary == "ALPHA" select o).Count());
Assert.AreEqual(1, (from o in db.Table<TestObj>() where o.CollateRTrim == "Alpha " select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateRTrim == "ALPHA " select o).Count());
Assert.AreEqual(1, (from o in db.Table<TestObj>() where o.CollateRTrim == "Alpha" select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateRTrim == "ALPHA" select o).Count());
Assert.AreEqual(1, (from o in db.Table<TestObj>() where o.CollateNoCase == "Alpha " select o).Count());
Assert.AreEqual(1, (from o in db.Table<TestObj>() where o.CollateNoCase == "ALPHA " select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateNoCase == "Alpha" select o).Count());
Assert.AreEqual(0, (from o in db.Table<TestObj>() where o.CollateNoCase == "ALPHA" select o).Count());
}
示例4: IsKeyPrivate_Returns_True
public void IsKeyPrivate_Returns_True()
{
PrivateKeySetter setter = new PrivateKeySetter();
TestObj test = new TestObj();
Assert.IsTrue(setter.IsKeyPrivate(test, "PrivateSetter"));
}
示例5: IsKeyPrivate_Throws_If_Property_Not_Found
public void IsKeyPrivate_Throws_If_Property_Not_Found()
{
PrivateKeySetter setter = new PrivateKeySetter();
TestObj test = new TestObj();
setter.IsKeyPrivate(test, "NotFound");
}
示例6: IsKeyPrivate_Defaults_To_Expected_Convention
public void IsKeyPrivate_Defaults_To_Expected_Convention()
{
PrivateKeySetter setter = new PrivateKeySetter();
TestObj test = new TestObj();
Assert.IsTrue(setter.IsKeyPrivate(test));
}
示例7: testobj_get_set_testprop
public void testobj_get_set_testprop()
{
const int expected = 2;
var obj = new TestObj();
obj.TestProp = expected;
Assert.Equal(expected, obj.TestProp);
}
示例8: testobj_get_set_BSTR_prop
public void testobj_get_set_BSTR_prop()
{
const string expected = "Test set string";
var obj = new TestObj();
obj.TestStringProp2 = expected;
Assert.Equal(expected, obj.TestStringProp2);
}
示例9: ObjToDicTest
//[Test]
public void ObjToDicTest()
{
var obj = new TestObj { Country = CountryCodeEnum1.DZ, Other = OtherEnum1.EnumValue2 };
var sh = new MappingSchema { Extensions = TypeExtension.GetExtensions("Map.xml") };
var pars = sh.MapObjectToDictionary(obj);
Assert.AreEqual("DZ", pars["country_code"]);
Assert.AreEqual(101, pars["other"]);
}
示例10: SetId_Defaults_To_Expected_Convention
public void SetId_Defaults_To_Expected_Convention()
{
PrivateKeySetter setter = new PrivateKeySetter();
TestObj test = new TestObj();
const string idValue = "10";
Assert.IsTrue(setter.SetKey(test, idValue));
Assert.IsTrue(test.PrivateSetter == 0);
Assert.IsTrue(test.PublicSetter == Guid.Empty);
}
示例11: SetId_Returns_True_And_Sets_Property_With_Private_Setter
public void SetId_Returns_True_And_Sets_Property_With_Private_Setter()
{
PrivateKeySetter setter = new PrivateKeySetter();
TestObj test = new TestObj();
const int idValue = 10;
Assert.IsTrue(setter.SetKey(test, "PrivateSetter", idValue));
Assert.IsTrue(test.Id == null);
Assert.IsTrue(test.PrivateSetter == idValue);
Assert.IsTrue(test.PublicSetter == Guid.Empty);
}
示例12: TestGetGUID
public void TestGetGUID()
{
var testObj = new TestObj("This is a simple test hope shit does not go wrong!!", 666);
var record = database.Save(testObj);
Assert.IsTrue(Object.ReferenceEquals(testObj, record.Value), "IObjectDatabase.Save failed to return the same object that was passed to it in the returned record");
record = database.Get<TestObj>(record.UniqueId);
Assert.IsTrue(Object.ReferenceEquals(testObj, record.Value), "IObjectDatabase.Get(GUID) failed to return an object from memory");
database.Dispose();
database = new SQLiteObjectDatabase(databaseFile);
var newRecord = database.Get<TestObj>(record.UniqueId);
Assert.IsTrue(record.UniqueId == newRecord.UniqueId && testObj.Value1 == newRecord.Value.Value1 && testObj.Value2 == newRecord.Value.Value2, "IObjectDatabase.Get(GUID) failed to return an object from storage");
}
示例13: StringStartsWith
public void StringStartsWith()
{
var db = new OrmTestSession();
db.CreateTable<TestObj>();
var testObj = new TestObj { Name = "This is a Good name" };
db.Insert(testObj);
var stringContainsTest = (from n in db.Table<TestObj>() where n.Name.StartsWith("This") select n).Single();
Assert.AreEqual(testObj.Id, stringContainsTest.Id);
var finder = "name";
stringContainsTest = (from n in db.Table<TestObj>() where n.Name.StartsWith(finder) select n).SingleOrDefault();
Assert.IsNull(stringContainsTest);
}
示例14: InsertSucceeds
public void InsertSucceeds ()
{
var db = new TestDb ();
db.CreateTable<TestObj> ();
var o = new TestObj {
Text = "Hello",
IgnoredText = "World",
};
db.Insert (o);
Assert.AreEqual (1, o.Id);
}
示例15: StringContains
public void StringContains()
{
var db = new OrmTestSession();
db.CreateTable<TestObj>();
var testObj = new TestObj { Name = "This is a Good name" };
db.Insert(testObj);
var stringContainsTest = (from n in db.Table<TestObj>() where n.Name.Contains("Good") select n).Single();
Assert.AreEqual(testObj.Id, stringContainsTest.Id);
var finder = "good";
stringContainsTest = (from n in db.Table<TestObj>() where n.Name.Contains(finder) select n).Single();
Assert.AreEqual(testObj.Id, stringContainsTest.Id);
}