Esempio n. 1
0
		public void ShouldCheckIsWhiteSpaceTest()
		{
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsFalse(dataTypeFascade.IsWhiteSpace(null));
			Assert.IsTrue(dataTypeFascade.IsWhiteSpace("   "));
			Assert.IsFalse(dataTypeFascade.IsWhiteSpace("daniel"));
			Assert.IsFalse(dataTypeFascade.IsWhiteSpace("   daniel     "));
		}
Esempio n. 2
0
		public void ShouldCheckIsNullOrEmptyTest()
		{
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsTrue(dataTypeFascade.IsNullOrEmpty(null));
			Assert.IsTrue(dataTypeFascade.IsNullOrEmpty(string.Empty));
			Assert.IsFalse(dataTypeFascade.IsNullOrEmpty("   "));
			Assert.IsFalse(dataTypeFascade.IsNullOrEmpty("daniel"));
			Assert.IsFalse(dataTypeFascade.IsNullOrEmpty("   daniel     "));
		}
Esempio n. 3
0
		public void ShouldWithNullNotGetCharTest()
		{
			Char ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsFalse(result = dataTypeFascade.TryParse<Char>(null, out ovalue));
		}
Esempio n. 4
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);
		}
Esempio n. 5
0
		public void ShouldSafeToStringTest()
		{
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.AreEqual("123.456", dataTypeFascade.SafeToString(123.456));
			Assert.AreEqual("123.46", dataTypeFascade.SafeToString(123.456, "n"));
			Assert.AreEqual("urn:foo", dataTypeFascade.SafeToString(new Uri("urn:foo"), "n"));

			Assert.AreEqual(string.Empty, dataTypeFascade.SafeToString((object)null, null));
			Assert.AreEqual(null, dataTypeFascade.SafeToString((object)null, null, null));
			Assert.AreEqual("1", dataTypeFascade.SafeToString((object)string.Empty, null, "1", true));
		}
Esempio n. 6
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));
		}
Esempio n. 7
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));
		}
Esempio n. 8
0
		public void ShouldNotGetGuidTest()
		{
			Guid ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsFalse(result = dataTypeFascade.TryParse<Guid>("gibberish", out ovalue));
		}
Esempio n. 9
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);
		}
Esempio n. 10
0
		public void ShouldGetNonNullOnNonNullValueNullableChangeTypeTick1Test()
		{
			int? value;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			value = dataTypeFascade.ChangeType<int?>((byte)1);

			Assert.IsNotNull(value);
			Assert.IsInstanceOf<int?>(value);
			Assert.AreEqual((int?)1, value);
		}
Esempio n. 11
0
		public void ShouldGetNonNullOnNonNullValueChangeTypeTest()
		{
			object value;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			value = dataTypeFascade.ChangeType((byte)1, typeof(int));

			Assert.IsNotNull(value);
			Assert.IsInstanceOf<int>(value);
			Assert.AreEqual((int)1, value);
		}
Esempio n. 12
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);
		}
Esempio n. 13
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);
		}
Esempio n. 14
0
		public void ShouldGetDefaultValueTest()
		{
			object defaultValue;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			defaultValue = dataTypeFascade.DefaultValue(typeof(int));

			Assert.AreEqual(0, defaultValue);

			defaultValue = dataTypeFascade.DefaultValue(typeof(int?));

			Assert.IsNull(defaultValue);
		}
Esempio n. 15
0
		public void ShouldGetDefaultOnNullValueChangeTypeTick1Test()
		{
			int value;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			value = dataTypeFascade.ChangeType<int>(null);

			Assert.AreEqual(default(int), value);
		}
Esempio n. 16
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));
		}
Esempio n. 17
0
		public void ShouldNotGetEnumTest()
		{
			CharSet ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsFalse(result = dataTypeFascade.TryParse<CharSet>("gibberish", out ovalue));
		}
Esempio n. 18
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);
		}
Esempio n. 19
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));
		}
Esempio n. 20
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);
		}
Esempio n. 21
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));
		}
Esempio n. 22
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);
		}
Esempio n. 23
0
		public void ShouldPreventNullCoaleseTest()
		{
			bool result;
			object objA, objB;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			// both null
			objA = null;
			objB = (int)0;
			result = dataTypeFascade.ObjectsEqualValueSemantics(objA, objB);
			Assert.IsFalse(result);
		}
Esempio n. 24
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);
		}
Esempio n. 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);
		}
Esempio n. 26
0
		public void ShouldNotGetDateTimeOffsetTest()
		{
			DateTimeOffset ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsFalse(result = dataTypeFascade.TryParse<DateTimeOffset>("gibberish", out ovalue));
		}
Esempio n. 27
0
		public void ShouldWithNullCanGetDBNullTest()
		{
			DBNull ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsTrue(result = dataTypeFascade.TryParse<DBNull>(null, out ovalue));
		}
Esempio n. 28
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));
		}
Esempio n. 29
0
		public void ShouldWithNullNotGetDateTimeTest()
		{
			DateTime ovalue;
			bool result;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			Assert.IsFalse(result = dataTypeFascade.TryParse<DateTime>(null, out ovalue));
		}
Esempio n. 30
0
		public void ShouldGetDefaultOnNullValueChangeTypeTest()
		{
			object value;
			DataTypeFascade dataTypeFascade;

			dataTypeFascade = new DataTypeFascade();

			value = dataTypeFascade.ChangeType(null, typeof(int));

			Assert.AreEqual(default(int), value);
		}