public void String1() { var sut = new Typed(); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["String1"], null); Aver.IsNull(sut.String1); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["String1"], "abra"); Aver.AreEqual("abra", sut.String1); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["String1"], null); Aver.IsNull(sut.String1); sut["String1"] = "yaga"; Aver.AreEqual("yaga", sut.String1); }
public void Int3() { var sut = new Typed(); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["Int3"], null); Aver.AreEqual(0, sut.Int3); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["Int3"], -1234); Aver.AreEqual(-1234, sut.Int3); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["Int3"], null); Aver.AreEqual(0, sut.Int3); sut["Int3"] = null; Aver.AreEqual(0, sut.Int3); sut["Int3"] = 890; Aver.AreEqual(890, sut.Int3); }
public void Int2() { var sut = new Typed(); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["Int2"], null); Aver.AreEqual(null, sut.Int2); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["Int2"], -12345); Aver.AreEqual(-12345, sut.Int2); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["Int2"], null); Aver.AreEqual(null, sut.Int2); sut["Int2"] = null; Aver.AreEqual(null, sut.Int2); sut["Int2"] = 1890; Aver.AreEqual(1890, sut.Int2); }
public void BenchmarkIntNullable() { var sut = new Typed(); var fd = sut.Schema["Int2"]; var time = Timeter.StartNew(); for (var i = 0; i < CNT; i++) { sut.SetFieldValue(fd, null); sut.SetFieldValue(fd, 123); } time.Stop(); "Speed: {0:n0} ops/sec".SeeArgs(CNT / time.ElapsedSec); }
public void IntArray2() { var sut = new Typed(); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["IntArray2"], null); Aver.IsNull(sut.IntArray2); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["IntArray2"], new int?[] { 1, null, 7, 1 }); Aver.AreArraysEquivalent(new int?[] { 1, null, 7, 1 }, sut.IntArray2); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["IntArray2"], null); Aver.IsNull(sut.IntArray2); sut["IntArray2"] = null; Aver.IsNull(sut.IntArray2); sut["IntArray2"] = new int?[] { 2, 1, 2, null, null, -5 }; Aver.AreArraysEquivalent(new int?[] { 2, 1, 2, null, null, -5 }, sut.IntArray2); }
public void IntArray1() { var sut = new Typed(); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["IntArray1"], null); Aver.IsNull(sut.IntArray1); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["IntArray1"], new int[] { 1, 2, 3 }); Aver.AreArraysEquivalent(new int[] { 1, 2, 3 }, sut.IntArray1); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["IntArray1"], null); Aver.IsNull(sut.IntArray1); sut["IntArray1"] = null; Aver.IsNull(sut.IntArray1); sut["IntArray1"] = new int[] { 2, 1, 2, 3 }; Aver.AreArraysEquivalent(new int[] { 2, 1, 2, 3 }, sut.IntArray1); }
public void MyEnum2() { var sut = new Typed(); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["MyEnum2"], null); Aver.IsTrue(null == sut.MyEnum2); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["MyEnum2"], MyEnum.C); Aver.IsTrue(MyEnum.C == sut.MyEnum2); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["MyEnum2"], null); Aver.IsTrue(null == sut.MyEnum2); sut["MyEnum2"] = null; Aver.IsTrue(null == sut.MyEnum2); sut["MyEnum2"] = MyEnum.B; Aver.IsTrue(MyEnum.B == sut.MyEnum2); }
public void Gdid1() { var sut = new Typed(); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["Gdid1"], null); Aver.AreEqual(GDID.ZERO, sut.Gdid1); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["Gdid1"], new GDID(1, 1)); Aver.AreEqual(new GDID(1, 1), sut.Gdid1); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["Gdid1"], null); Aver.AreEqual(GDID.ZERO, sut.Gdid1); sut["Gdid1"] = null; Aver.AreEqual(GDID.ZERO, sut.Gdid1); sut["Gdid1"] = new GDID(1, 234); Aver.AreEqual(new GDID(1, 234), sut.Gdid1); sut["Gdid1"] = 1237890; Aver.AreEqual(new GDID(0, 1237890), sut.Gdid1); }
public void Gdid2() { var sut = new Typed(); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["Gdid2"], null); Aver.AreEqual(null, sut.Gdid2); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["Gdid2"], new GDID(1, 1)); Aver.AreEqual(new GDID(1, 1), sut.Gdid2); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["Gdid2"], null); Aver.AreEqual(null, sut.Gdid2); sut["Gdid2"] = null; Aver.AreEqual(null, sut.Gdid2); sut["Gdid2"] = new GDID(1, 1234); Aver.AreEqual(new GDID(1, 1234), sut.Gdid2); sut["Gdid2"] = 7890; Aver.AreEqual(new GDID(0, 7890), sut.Gdid2); }
public void TypedArray1() { var sut = new Typed(); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["TypedArray1"], null); Aver.IsNull(sut.Typed1); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["TypedArray1"], new [] { new Typed { String1 = "abc111" } }); Aver.AreEqual("abc111", sut.TypedArray1[0].String1); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["TypedArray1"], null); Aver.IsNull(sut.TypedArray1); sut["TypedArray1"] = null; Aver.IsNull(sut.TypedArray1); sut["TypedArray1"] = new[] { new Typed { String1 = "def321" } }; Aver.AreEqual("def321", sut.TypedArray1[0].String1); }
public void Typed1() { var sut = new Typed(); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["Typed1"], null); Aver.IsNull(sut.Typed1); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["Typed1"], new Typed { String1 = "abc" }); Aver.AreEqual("abc", sut.Typed1.String1); sut.SetFieldValue(Schema.GetForTypedDoc <Typed>()["Typed1"], null); Aver.IsNull(sut.Typed1); sut["Typed1"] = null; Aver.IsNull(sut.Typed1); sut["Typed1"] = new Typed { String1 = "def" }; Aver.AreEqual("def", sut.Typed1.String1); }