public void ComparesonInstanceEquals()
		{
			var comparer = new PocoPkComparer<Users>();
			Assert.That(comparer.Equals(new Users { UserID = 23 }, new Users { UserID = 4234 }), Is.False);
			var sharedInstance = new Users();
			Assert.That(comparer.Equals(sharedInstance, sharedInstance), Is.True);
		}
Ejemplo n.º 2
0
		public static Users Factory(IDataRecord record)
		{
			Users super;
			super = new Users();
			super.UserID = ((long)(record["User_ID"]));
			object username;
			username = record["UserName"];
			if ((username == System.DBNull.Value))
			{
				super.UserName = null;
			}
			else
			{
				super.UserName = ((string)(username));
			}
			return super;
		}
Ejemplo n.º 3
0
		public void Contains()
		{
			var user = new Users();
			_users.Add(user);

			//Add TestMethod
			if (_useObjectCopy)
				Assert.That(_users.Contains(user), Is.True);
			else
				Assert.That(_users.Contains(user), Is.False);
		}
Ejemplo n.º 4
0
		public void Add()
		{
			var user = new Users();
			_users.Add(user);
			Assert.That(user, Is.Not.Null);
			Assert.That(user.UserID, Is.EqualTo(1));
		}
Ejemplo n.º 5
0
		public void Enumerate()
		{
			var user = new Users();
			_users.Add(user);
			if (_useObjectCopy)
			{
				_users.Add(user);
				Assert.That(_users.Count, Is.EqualTo(1));
				Assert.That(_users.ToArray(), Is.Not.Null.And.Property("Length").EqualTo(1));
			}
			else
			{
				Assert.That(() => _users.Add(user), Throws.Exception.TypeOf<InvalidOperationException>());
				Assert.That(_users.Count, Is.EqualTo(1));
				Assert.That(_users.ToArray(), Is.Not.Null.And.Property("Length").EqualTo(1));
			}

			_users.Add(new Users());
			_users.Add(new Users());
			_users.Add(new Users());
			_users.Add(new Users());
			Assert.That(_users.Count, Is.EqualTo(5));
			Assert.That(_users.ToArray(), Is.Not.Null.And.Property("Length").EqualTo(5));

			var arr = new object[_users.Count];
			Assert.That(() => _users.CopyTo(arr, 0), Throws.Nothing);

			var userArr = new Users[_users.Count];
			Assert.That(() => _users.CopyTo(userArr, 0), Throws.Nothing);
		}
Ejemplo n.º 6
0
		public void Remove()
		{
			var user = new Users();
			_users.Add(user);

			//Add TestMethod
			Assert.That(_users.Remove(user), Is.True);
			Assert.That(_users.Count, Is.EqualTo(0));
		}
Ejemplo n.º 7
0
		public void Count()
		{
			var user = new Users();
			_users.Add(user);

			//Add TestMethod
			Assert.That(_users.Count, Is.EqualTo(1));
		}
Ejemplo n.º 8
0
		public void ContainsId()
		{
			var user = new Users();
			_users.Add(user);

			//Add TestMethod
			Assert.That(_users.Contains(user.UserID), Is.True);
		}
Ejemplo n.º 9
0
		public void FakeClassComplexProperty()
		{
			var cache = new DbConfig(true);
			Assert.That(() =>
			{
				var fakeType = cache.GetFake("FakeType");

				fakeType.Propertys.Add("Test", new DbAutoStaticPropertyInfoCache<Users>("Test", fakeType.Type));

				Assert.That(fakeType.Propertys.Count, Is.EqualTo(1));
				Assert.That(fakeType.Mehtods.Count, Is.EqualTo(6));
				Assert.That(fakeType.Attributes, Is.Empty);

				var refElement = fakeType.DefaultFactory();
				var originalValue = new Users();

				Assert.That(refElement, Is.Not.Null.And.TypeOf(fakeType.Type));

				var propTest = fakeType.Propertys["Test"];
				Assert.That(propTest, Is.Not.Null);
				propTest.Setter.Invoke(refElement, originalValue);
				var propValue = propTest.Getter.Invoke(refElement);
				Assert.That(propValue, Is.Not.Null.And.EqualTo(originalValue));
			}, Throws.Nothing);
		}