Beispiel #1
0
		public void ShouldFailOnInvalidGenericTypeTryParseTest()
		{
			KeyValuePair<int, int> ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			result = dataTypeFascade.TryParse<KeyValuePair<int, int>>(DBNull.Value.ToString(), out ovalue);
		}
Beispiel #2
0
		public void ShouldSpecialGetValueOnNullNullableTryParseTest()
		{
			object ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			result = dataTypeFascade.TryParse(typeof(int?), null, out ovalue);
			Assert.IsTrue(result);
			Assert.AreEqual((int?)null, ovalue);
		}
Beispiel #3
0
		public void ShouldWithNullNotGetCharTest()
		{
			Char ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsFalse(result = dataTypeFascade.TryParse<Char>(null, out ovalue));
		}
Beispiel #4
0
		public void ShouldNotGetSingleTest()
		{
			Single ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsFalse(result = dataTypeFascade.TryParse<Single>("gibberish", out ovalue));
			Assert.IsFalse(result = dataTypeFascade.TryParse<Single>("999,282,300,000,000,000,000,000,000,000,000,000,000.00", out ovalue));
		}
Beispiel #5
0
		public void ShouldNotGetUInt64Test()
		{
			UInt64 ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsFalse(result = dataTypeFascade.TryParse<UInt64>("gibberish", out ovalue));
			Assert.IsFalse(result = dataTypeFascade.TryParse<UInt64>("99999999999999999999", out ovalue));
		}
Beispiel #6
0
		public void ShouldNotGetDoubleTest()
		{
			Double ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsFalse(result = dataTypeFascade.TryParse<Double>("gibberish", out ovalue));
			Assert.IsFalse(result = dataTypeFascade.TryParse<Double>("999,769,313,486,232,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00", out ovalue));
		}
Beispiel #7
0
		public void ShouldNotGetGuidTest()
		{
			Guid ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsFalse(result = dataTypeFascade.TryParse<Guid>("gibberish", out ovalue));
		}
Beispiel #8
0
		public void ShouldGetDBNullTest()
		{
			DBNull ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			result = dataTypeFascade.TryParse<DBNull>("", out ovalue);
			Assert.IsTrue(result);
			Assert.AreEqual(DBNull.Value, ovalue);

			result = dataTypeFascade.TryParse<DBNull>("___", out ovalue);
			Assert.IsTrue(result);
			Assert.AreEqual(DBNull.Value, ovalue);
		}
Beispiel #9
0
		public void ShouldGetDecimalTest()
		{
			Decimal ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			result = dataTypeFascade.TryParse<Decimal>("0", out ovalue);
			Assert.IsTrue(result);
			Assert.AreEqual(0, ovalue);
		}
Beispiel #10
0
		public void ShouldGetCharTest()
		{
			Char ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			result = dataTypeFascade.TryParse<Char>("0", out ovalue);
			Assert.IsTrue(result);
			Assert.AreEqual('0', ovalue);
		}
Beispiel #11
0
		public void ShouldGetDateTimeTest()
		{
			DateTime ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			result = dataTypeFascade.TryParse<DateTime>("6/22/2003", out ovalue);
			Assert.IsTrue(result);
			Assert.AreEqual(new DateTime(2003, 6, 22), ovalue);
		}
Beispiel #12
0
		public void ShouldGetBooleanTest()
		{
			Boolean ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			result = dataTypeFascade.TryParse<Boolean>("true", out ovalue);
			Assert.IsTrue(result);
			Assert.AreEqual(true, ovalue);

			result = dataTypeFascade.TryParse<Boolean>("false", out ovalue);
			Assert.IsTrue(result);
			Assert.AreEqual(false, ovalue);
		}
Beispiel #13
0
		public void ShouldFailOnNullTypeTryParseTest()
		{
			object ovalue;
			bool result;

			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			result = dataTypeFascade.TryParse(null, string.Empty, out ovalue);
		}
Beispiel #14
0
		public void ShouldFailOnInvalidTypeTryParseTest()
		{
			object ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			result = dataTypeFascade.TryParse(typeof(KeyValuePair<int, int>), DBNull.Value.ToString(), out ovalue);
		}
Beispiel #15
0
		public void ShouldNotGetDateTimeOffsetTest()
		{
			DateTimeOffset ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsFalse(result = dataTypeFascade.TryParse<DateTimeOffset>("gibberish", out ovalue));
		}
Beispiel #16
0
		public void ShouldGetEnumTest()
		{
			CharSet ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			result = dataTypeFascade.TryParse<CharSet>("Unicode", out ovalue);
			Assert.IsTrue(result);
			Assert.AreEqual(CharSet.Unicode, ovalue);
		}
Beispiel #17
0
		public void ShouldNotGetDecimalTest()
		{
			Decimal ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsFalse(result = dataTypeFascade.TryParse<Decimal>("gibberish", out ovalue));
			Assert.IsFalse(result = dataTypeFascade.TryParse<Decimal>("11111111111111111111111111111111111111", out ovalue));
		}
Beispiel #18
0
		public void ShouldGetGuidTest()
		{
			Guid ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			result = dataTypeFascade.TryParse<Guid>("{00000000-0000-0000-0000-000000000000}", out ovalue);
			Assert.IsTrue(result);
			Assert.AreEqual(Guid.Empty, ovalue);
		}
Beispiel #19
0
		public void ShouldNotGetEnumTest()
		{
			CharSet ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsFalse(result = dataTypeFascade.TryParse<CharSet>("gibberish", out ovalue));
		}
Beispiel #20
0
		public void ShouldGetSingleTest()
		{
			Single ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			result = dataTypeFascade.TryParse<Single>("0", out ovalue);
			Assert.IsTrue(result);
			Assert.AreEqual(0, ovalue);
		}
Beispiel #21
0
		public void ShouldNotGetSByteTest()
		{
			SByte ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsFalse(result = dataTypeFascade.TryParse<SByte>("gibberish", out ovalue));
			Assert.IsFalse(result = dataTypeFascade.TryParse<SByte>("1111111111111111111", out ovalue));
		}
Beispiel #22
0
		public void ShouldGetStringTest()
		{
			String ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			result = dataTypeFascade.TryParse<String>("0-8-8-8-8-8-8-8-c", out ovalue);
			Assert.IsTrue(result);
			Assert.AreEqual("0-8-8-8-8-8-8-8-c", ovalue);
		}
Beispiel #23
0
		public void ShouldNotGetTimeSpanTest()
		{
			TimeSpan ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsFalse(result = dataTypeFascade.TryParse<TimeSpan>("gibberish", out ovalue));
			Assert.IsFalse(result = dataTypeFascade.TryParse<TimeSpan>("99999999.02:48:05.4775807", out ovalue));
		}
Beispiel #24
0
		public void ShouldGetTimeSpanTest()
		{
			TimeSpan ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			result = dataTypeFascade.TryParse<TimeSpan>("0:0:0", out ovalue);
			Assert.IsTrue(result);
			Assert.AreEqual(TimeSpan.Zero, ovalue);
		}
Beispiel #25
0
		public void ShouldSpecialGetValueOnNullNullableGenericTryParseTest()
		{
			int? ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			result = dataTypeFascade.TryParse<int?>(null, out ovalue);
			Assert.IsTrue(result);
			Assert.AreEqual((int?)null, ovalue);
		}
Beispiel #26
0
		public void ShouldGetUInt64Test()
		{
			UInt64 ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			result = dataTypeFascade.TryParse<UInt64>("0", out ovalue);
			Assert.IsTrue(result);
			Assert.AreEqual(0, ovalue);
		}
Beispiel #27
0
		public void ShouldWithNullCanGetDBNullTest()
		{
			DBNull ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsTrue(result = dataTypeFascade.TryParse<DBNull>(null, out ovalue));
		}
Beispiel #28
0
		public void ShouldGetVersionTest()
		{
			Version ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			result = dataTypeFascade.TryParse<Version>("1.2.3.4", out ovalue);
			Assert.IsTrue(result);
			Assert.AreEqual(new Version(1, 2, 3, 4), ovalue);

			result = dataTypeFascade.TryParse<Version>("0.0.0.0", out ovalue);
			Assert.IsTrue(result);
			Assert.AreEqual(new Version(0, 0, 0, 0), ovalue);
		}
Beispiel #29
0
		public void ShouldWithNullNotGetDateTimeTest()
		{
			DateTime ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsFalse(result = dataTypeFascade.TryParse<DateTime>(null, out ovalue));
		}
Beispiel #30
0
		public void ShouldWithNullNotGetVersionTest()
		{
			Version ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsFalse(result = dataTypeFascade.TryParse<Version>(null, out ovalue));
		}