public void ReadChar() { char expectedChar = 'a'; this.profile.SetProfile(this.ident, expectedChar); reader = new ProfileReader(this.profile.GetProfile(this.ident)); char resultChar = reader.GetChar(null); Assert.AreEqual(expectedChar, resultChar); }
public void GetEachPrimitiveFromHashtable() { bool expectedBool = true; string expectedString = "test"; DateTime expectedDateTime = DateTime.Now; byte expectedByte = 0xA; char expectedChar = 'a'; DbProfileProviderFixture.TestClass expectedObject = new DbProfileProviderFixture.TestClass(); expectedObject.Field1 = "A"; expectedObject.Field2 = -100; short expectedShort = 1; int expectedInt = 100; long expectedLong = 10101010101010; float expectedFloat = 10101.101f; double expectedDouble = 10101.10101; decimal expectedDecimal = 10101.101010101010101m; Hashtable hash = new Hashtable(); hash["string1"] = expectedString; hash["bool1"] = expectedBool; hash["dateTime1"] = expectedDateTime; hash["byte1"] = expectedByte; hash["char1"] = expectedChar; hash["object1"] = expectedObject; hash["short1"] = expectedShort; // 16 bits hash["int1"] = expectedInt; // 32 bits hash["long1"] = expectedLong; // 64 bits hash["float1"] = expectedFloat; // 32bits hash["double1"] = expectedDouble; // 64 bits hash["decimal1"] = expectedDecimal; // 128 bits this.profile.SetProfile(this.ident, hash); object result = this.profile.GetProfile(this.ident); ProfileReader reader = new ProfileReader(result); bool resultBool = reader.GetBool("bool1"); string resultString = reader.GetString("string1"); DateTime resultDateTime = reader.GetDateTime("dateTime1"); byte resultByte = reader.GetByte("byte1"); char resultChar = reader.GetChar("char1"); short resultShort = reader.GetShortInt("short1"); int resultInt = reader.GetInt("int1"); long resultLong = reader.GetLongInt("long1"); float resultFloat = reader.GetFloat("float1"); double resultDouble = reader.GetDouble("double1"); decimal resultDecimal = reader.GetDecimal("decimal1"); DbProfileProviderFixture.TestClass resultObject = (DbProfileProviderFixture.TestClass)reader.GetObject("object1"); Assert.AreEqual(expectedBool, resultBool); Assert.AreEqual(expectedString, resultString); Assert.AreEqual(expectedDateTime, resultDateTime); Assert.AreEqual(expectedByte, resultByte); Assert.AreEqual(expectedChar, resultChar); Assert.AreEqual(expectedObject.Field1, resultObject.Field1); Assert.AreEqual(expectedObject.Field2, resultObject.Field2); Assert.AreEqual(expectedShort, resultShort); Assert.AreEqual(expectedInt, resultInt); Assert.AreEqual(expectedLong, resultLong); Assert.AreEqual(expectedFloat, resultFloat); Assert.AreEqual(expectedDouble, resultDouble); Assert.AreEqual(expectedDecimal, resultDecimal); }