From 23d478f2fa06d1dedabfb24cf6ff763b586173ce Mon Sep 17 00:00:00 2001 From: Kunnis Date: Sun, 9 Aug 2009 02:01:21 -0500 Subject: Adding in Reflection-based testing, to ensure that all properties are covered. --- OpenSim/Data/Tests/BasicUserTest.cs | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'OpenSim/Data/Tests/BasicUserTest.cs') diff --git a/OpenSim/Data/Tests/BasicUserTest.cs b/OpenSim/Data/Tests/BasicUserTest.cs index 4e4ddc8..21d1a7e 100644 --- a/OpenSim/Data/Tests/BasicUserTest.cs +++ b/OpenSim/Data/Tests/BasicUserTest.cs @@ -118,13 +118,6 @@ namespace OpenSim.Data.Tests } [Test] - public void T999_StillNull() - { - Assert.That(db.GetUserByUUID(zero), Is.Null); - Assert.That(db.GetAgentByUUID(zero), Is.Null); - } - - [Test] public void T010_CreateUser() { UserProfileData u1 = NewUser(user1,fname1,lname1); @@ -396,6 +389,22 @@ namespace OpenSim.Data.Tests Assert.That(customtype,Is.EqualTo(u1a.CustomType), "Assert.That(customtype,Is.EqualTo(u1a.CustomType))"); Assert.That(partner,Is.EqualTo(u1a.Partner), "Assert.That(partner,Is.EqualTo(u1a.Partner))"); } + + [Test] + public void T017_UserUpdateRandomPersistency() + { + UUID id = user5; + UserProfileData u = db.GetUserByUUID(id); + ScrambleForTesting.Scramble(u); + u.ID = id; + + db.UpdateUserProfile(u); + UserProfileData u1a = db.GetUserByUUID(id); + Assert.That(u1a, Constraints.PropertyCompareConstraint(u) + .IgnoreProperty(x=>x.HomeRegionX) + .IgnoreProperty(x=>x.HomeRegionY) + ); + } [Test] public void T020_CreateAgent() @@ -660,6 +669,13 @@ namespace OpenSim.Data.Tests Assert.That(avatarheight,Is.EqualTo(app.AvatarHeight), "Assert.That(avatarheight,Is.EqualTo(app.AvatarHeight))"); } + [Test] + public void T999_StillNull() + { + Assert.That(db.GetUserByUUID(zero), Is.Null); + Assert.That(db.GetAgentByUUID(zero), Is.Null); + } + public UserProfileData NewUser(UUID id,string fname,string lname) { UserProfileData u = new UserProfileData(); -- cgit v1.1 From f6251ce810e0bebe68d08a8e4b20a9dfc3fe1af6 Mon Sep 17 00:00:00 2001 From: Kunnis Date: Sat, 15 Aug 2009 06:08:36 -0500 Subject: * Modified SQLite/SQLiteInventoryStore.cs to not throw if the inventory row does not exist, to match the mysql behavior. * Modified SQLite/SQLiteRegionData.cs to only persist temporary items following the same rules mysql uses. * Added another ignore to the inventory test that was missing. * Added a few more ignores to the RegionTest that the first version of my test were missing. * Added ignoring the root Folder ID, which is set by the inventory system. * Added several improvements to the PropertyCompareConstraint: Protection against infinite loops, added IComparable (for UUID) and moved IComparable before the property matching. * Fixed a bug where I was saving the inside of the ignore expression instead of the outside of it. --- OpenSim/Data/Tests/BasicUserTest.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Data/Tests/BasicUserTest.cs') diff --git a/OpenSim/Data/Tests/BasicUserTest.cs b/OpenSim/Data/Tests/BasicUserTest.cs index 21d1a7e..a3c125d 100644 --- a/OpenSim/Data/Tests/BasicUserTest.cs +++ b/OpenSim/Data/Tests/BasicUserTest.cs @@ -403,6 +403,7 @@ namespace OpenSim.Data.Tests Assert.That(u1a, Constraints.PropertyCompareConstraint(u) .IgnoreProperty(x=>x.HomeRegionX) .IgnoreProperty(x=>x.HomeRegionY) + .IgnoreProperty(x=>x.RootInventoryFolderID) ); } -- cgit v1.1 From dd78c250aed0924d06e28a826c2ad565ca232045 Mon Sep 17 00:00:00 2001 From: Kunnis Date: Sun, 16 Aug 2009 03:35:31 -0500 Subject: * Added Expression based ignores to the PropertyScrambler, which makes a lot of the tests clearer because I'm not constantly resetting properties. --- OpenSim/Data/Tests/BasicUserTest.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'OpenSim/Data/Tests/BasicUserTest.cs') diff --git a/OpenSim/Data/Tests/BasicUserTest.cs b/OpenSim/Data/Tests/BasicUserTest.cs index a3c125d..f9feb9b 100644 --- a/OpenSim/Data/Tests/BasicUserTest.cs +++ b/OpenSim/Data/Tests/BasicUserTest.cs @@ -71,14 +71,7 @@ namespace OpenSim.Data.Tests public void SuperInit() { - try - { - XmlConfigurator.Configure(); - } - catch (Exception) - { - // I don't care, just leave log4net off - } + OpenSim.Tests.Common.TestLogging.LogToConsole(); random = new Random(); user1 = UUID.Random(); user2 = UUID.Random(); @@ -395,8 +388,7 @@ namespace OpenSim.Data.Tests { UUID id = user5; UserProfileData u = db.GetUserByUUID(id); - ScrambleForTesting.Scramble(u); - u.ID = id; + new PropertyScrambler().DontScramble(x=>x.ID).Scramble(u); db.UpdateUserProfile(u); UserProfileData u1a = db.GetUserByUUID(id); -- cgit v1.1