本文整理汇总了C#中TestObj类的典型用法代码示例。如果您正苦于以下问题:C# TestObj类的具体用法?C# TestObj怎么用?C# TestObj使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestObj类属于命名空间,在下文中一共展示了TestObj类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:robertmichaelwalsh,项目名称:CSharpFrontEnd,代码行数:34,代码来源:obj.cs
示例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());
}
开发者ID:jdasilva,项目名称:SQLite.Net-PCL,代码行数:34,代码来源:CollateTest.cs
示例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());
}
开发者ID:mattleibow,项目名称:Mono.Data.Sqlite.Orm,代码行数:34,代码来源:CollateTest.cs
示例4: IsKeyPrivate_Returns_True
public void IsKeyPrivate_Returns_True()
{
PrivateKeySetter setter = new PrivateKeySetter();
TestObj test = new TestObj();
Assert.IsTrue(setter.IsKeyPrivate(test, "PrivateSetter"));
}
开发者ID:Anupam-,项目名称:GenericRepository-1,代码行数:8,代码来源:PrivateIdSetterTests.cs
示例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");
}
开发者ID:Anupam-,项目名称:GenericRepository-1,代码行数:8,代码来源:PrivateIdSetterTests.cs
示例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));
}
开发者ID:Anupam-,项目名称:GenericRepository-1,代码行数:8,代码来源:PrivateIdSetterTests.cs
示例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);
}
开发者ID:Supermortal,项目名称:ATLProject1,代码行数:9,代码来源:ATLTests.cs
示例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);
}
开发者ID:Supermortal,项目名称:ATLProject1,代码行数:9,代码来源:ATLTests.cs
示例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"]);
}
开发者ID:MajidSafari,项目名称:bltoolkit,代码行数:10,代码来源:EnumExtension.cs
示例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);
}
开发者ID:Anupam-,项目名称:GenericRepository-1,代码行数:11,代码来源:PrivateIdSetterTests.cs
示例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);
}
开发者ID:Anupam-,项目名称:GenericRepository-1,代码行数:12,代码来源:PrivateIdSetterTests.cs
示例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");
}
开发者ID:AugustoAngeletti,项目名称:blockspaces,代码行数:12,代码来源:IObjectDatabaseTest.cs
示例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);
}
开发者ID:distributedlife,项目名称:Mono.Data.Sqlite.Orm,代码行数:14,代码来源:ContainsTest.cs
示例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);
}
开发者ID:BenjaminKim,项目名称:sqlite-net,代码行数:14,代码来源:IgnoreTest.cs
示例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);
}
开发者ID:distributedlife,项目名称:Mono.Data.Sqlite.Orm,代码行数:14,代码来源:ContainsTest.cs
示例16: can_deserialize_id_with_private_setter
public void can_deserialize_id_with_private_setter()
{
using (var documentStore = NewDocumentStore())
using (var session = documentStore.OpenSession())
{
var testObj = new TestObj(1000, 123);
session.Store(testObj);
session.SaveChanges();
session.Advanced.Clear();
var load = session.Load<TestObj>(1000);
Assert.Equal(123, load.AnotherLong);
Assert.Equal(1000, load.Id);
}
}
开发者ID:j2jensen,项目名称:ravendb,代码行数:15,代码来源:SerializingAndDeserializingWithRaven.cs
示例17: TestDateTime
void TestDateTime(TestDb db)
{
db.CreateTable<TestObj> ();
TestObj o, o2;
//
// Ticks
//
o = new TestObj {
ModifiedTime = new DateTime (2012, 1, 14, 3, 2, 1, 234),
};
db.Insert (o);
o2 = db.Get<TestObj> (o.Id);
Assert.AreEqual (o.ModifiedTime, o2.ModifiedTime);
}
开发者ID:FatJohn,项目名称:sqlite-net,代码行数:16,代码来源:DateTimeTest.cs
示例18: TestAsyncDateTime
void TestAsyncDateTime(SQLiteAsyncConnection db)
{
db.CreateTableAsync<TestObj> ().Wait ();
TestObj o, o2;
//
// Ticks
//
o = new TestObj {
ModifiedTime = new DateTime (2012, 1, 14, 3, 2, 1, 234),
};
db.InsertAsync (o).Wait ();
o2 = db.GetAsync<TestObj> (o.Id).Result;
Assert.AreEqual (o.ModifiedTime, o2.ModifiedTime);
}
开发者ID:FatJohn,项目名称:sqlite-net,代码行数:16,代码来源:DateTimeTest.cs
示例19: TestAsyncDateTime
private async Task TestAsyncDateTime(SQLiteAsyncConnection db)
{
await db.CreateTableAsync<TestObj>();
TestObj o, o2;
//
// Ticks
//
o = new TestObj
{
ModifiedTime = new DateTime(2012, 1, 14, 3, 2, 1),
};
await db.InsertAsync(o);
o2 = await db.GetAsync<TestObj>(o.Id);
Assert.AreEqual(o.ModifiedTime, o2.ModifiedTime);
}
开发者ID:happynik,项目名称:SQLite.Net-PCL,代码行数:17,代码来源:DateTimeTest.cs
示例20: GetDoesntHaveIgnores
public void GetDoesntHaveIgnores ()
{
var db = new TestDb ();
db.CreateTable<TestObj> ();
var o = new TestObj {
Text = "Hello",
IgnoredText = "World",
};
db.Insert (o);
var oo = db.Get<TestObj> (o.Id);
Assert.AreEqual ("Hello", oo.Text);
Assert.AreEqual (null, oo.IgnoredText);
}
开发者ID:BenjaminKim,项目名称:sqlite-net,代码行数:17,代码来源:IgnoreTest.cs
注:本文中的TestObj类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论