local p=require("\078\101\120\117\115\085\110\105\116\084\101\115\116\105\110\103")local u=require((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):WaitForChild("\078\101\120\117\115\080\108\117\103\105\110\070\114\097\109\101\119\111\114\107"))local L=u:GetResource("\066\097\115\101\046\078\101\120\117\115\067\111\110\116\097\105\110\101\114")local function i()local p=L.new()local u=L.new()local i=L.new()local o=L.new()p.Name="\084\101\115\116\067\111\110\116\097\105\110\101\114\049"u.Name="\084\101\115\116\067\111\110\116\097\105\110\101\114\050"i.Name="\084\101\115\116\067\111\110\116\097\105\110\101\114\051"o.Name="\084\101\115\116\067\111\110\116\097\105\110\101\114\052"return p,u,i,o end local function o(p,u,L,i)for u,o in pairs(u)do if o~=L[u]then p:Fail(i)end end for L,o in pairs(L)do if o~=u[L]then p:Fail(i)end end end p:RegisterUnitTest("\067\111\110\115\116\114\117\099\116\111\114",function(p)local u=L.new()p:AssertEquals(u.ClassName,"\078\101\120\117\115\067\111\110\116\097\105\110\101\114","\067\108\097\115\115 \110\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertEquals(u.Name,"\078\101\120\117\115\067\111\110\116\097\105\110\101\114","\078\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertEquals(tostring(u),"\078\101\120\117\115\067\111\110\116\097\105\110\101\114","\078\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\073\110\100\101\120\105\110\103",function(p)local u,L,o,F=i()L.Parent=u o.Parent=u F.Parent=o p:AssertSame(u.TestContainer2,L,"\073\110\100\101\120\105\110\103 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(u.TestContainer3,o,"\073\110\100\101\120\105\110\103 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(u.TestContainer3.TestContainer4,F,"\073\110\100\101\120\105\110\103 \105\115 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\072\105\100\100\101\110",function(p)local u,L=0,0 local F,t,C,j=i()F.ChildAdded:Connect(function(p)u=u+1 end)F.DescendantAdded:Connect(function(p)L=L+1 end)t.Hidden=true t.Parent=F C.Parent=F j.Parent=t p:AssertEquals(u,1,"\067\104\105\108\100\065\100\100\101\100 \102\105\114\101\100 \097\110 \105\110\099\111\114\114\101\099\116 \097\109\111\117\110\116 \111\102 \116\105\109\101\115\046")p:AssertEquals(L,1,"\068\101\115\099\101\110\100\097\110\116\065\100\100\101\100 \102\105\114\101\100 \097\110 \105\110\099\111\114\114\101\099\116 \097\109\111\117\110\116 \111\102 \116\105\109\101\115\046")o(p,F:GetChildren(),{C},"\071\101\116\067\104\105\108\100\114\101\110 \105\115 \105\110\099\111\114\114\101\099\116\046")o(p,F:GetDescendants(),{C},"\071\101\116\068\101\115\099\101\110\100\097\110\116\115 \105\115 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\065\110\099\101\115\116\114\121\067\104\097\110\103\101\100",function(p)local u,L,o,F=i()local t,C={},{}u.AncestryChanged:Connect(function(p,u)table.insert(t,p)table.insert(C,u)end)u.Parent=L L.Parent=o o.Parent=F u.Parent=F u.Parent=nil p:AssertSame(t[1],u,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(C[1],L,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(t[2],L,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(C[2],o,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(t[3],o,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(C[3],F,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(t[4],u,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(C[4],F,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(t[5],u,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(C[5],nil,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\067\104\105\108\100\065\100\100\101\100",function(p)local u,L,o,F=i()local t={}u.ChildAdded:Connect(function(p)table.insert(t,p)end)L.Parent=u o.Parent=u F.Parent=L F.Parent=u p:AssertSame(t[1],L,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(t[2],o,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(t[3],F,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(t[4],nil,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\067\104\105\108\100\082\101\109\111\118\101\100",function(p)local u,L,o,F=i()local t={}u.ChildRemoved:Connect(function(p)table.insert(t,p)end)L.Parent=u o.Parent=u F.Parent=L o.Parent=L L.Parent=nil o.Parent=nil F.Parent=nil p:AssertSame(t[1],o,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(t[2],L,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\068\101\115\099\101\110\100\097\110\116\065\100\100\101\100",function(p)local u,L,o,F=i()local t={}u.DescendantAdded:Connect(function(p)table.insert(t,p)end)L.Parent=u o.Parent=u F.Parent=L F.Parent=u p:AssertSame(t[1],L,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(t[2],o,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(t[3],F,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(t[4],F,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\068\101\115\099\101\110\100\097\110\116\082\101\109\111\118\105\110\103",function(p)local u,L,o,F=i()local t={}u.DescendantRemoving:Connect(function(p)table.insert(t,p)end)L.Parent=u o.Parent=u F.Parent=L L.Parent=nil o.Parent=nil F.Parent=nil p:AssertSame(t[1],L,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(t[2],F,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(t[3],o,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(t[4],nil,"\067\104\097\110\103\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\067\108\101\097\114\065\108\108\067\104\105\108\100\114\101\110",function(p)local u,L,o,F=i()L.Parent=u o.Parent=u F.Parent=L u:ClearAllChildren()p:AssertNil(L.Parent,"\080\097\114\101\110\116 \105\115 \115\116\105\108\108 \115\101\116\046")p:AssertNil(o.Parent,"\080\097\114\101\110\116 \105\115 \115\116\105\108\108 \115\101\116\046")p:AssertNil(F.Parent,"\080\097\114\101\110\116 \105\115 \115\116\105\108\108 \115\101\116\046")p:AssertErrors(function()L.Parent=u end,"\080\097\114\101\110\116 \105\115 \110\111\116 \108\111\099\107\101\100\046")p:AssertErrors(function()o.Parent=u end,"\080\097\114\101\110\116 \105\115 \110\111\116 \108\111\099\107\101\100\046")p:AssertErrors(function()F.Parent=u end,"\080\097\114\101\110\116 \105\115 \110\111\116 \108\111\099\107\101\100\046")end)p:RegisterUnitTest("\067\108\111\110\101",function(p)local u,L,o,F=i()L.Parent=u o.Parent=L F.Parent=o o.CustomProperty1=o o.CustomProperty2=F o.CustomProperty3=L o.CustomProperty4=u local t=L:Clone()p:AssertNotSame(t,L,"\073\110\115\116\097\110\099\101 \110\111\116 \099\108\111\110\101\100\046")p:AssertNil(t.Parent,"\080\097\114\101\110\116 \119\097\115 \115\101\116\046")p:AssertNotNil(t.TestContainer3,"\078\111 \105\110\115\116\097\110\099\101 \099\108\111\110\101\100\046")p:AssertNotSame(t.TestContainer3,o,"\073\110\115\116\097\110\099\101 \110\111\116 \099\108\111\110\101\100\046")p:AssertNotNil(t.TestContainer3.TestContainer4,"\078\111 \105\110\115\116\097\110\099\101\100 \099\108\111\110\101\100\046")p:AssertNotSame(t.TestContainer3.TestContainer4,"\073\110\115\116\097\110\099\101 \110\111\116 \099\108\111\110\101\100\046")F.Name="\084\101\115\116\067\111\110\116\097\105\110\101\114\053"p:AssertSame(F.Name,"\084\101\115\116\067\111\110\116\097\105\110\101\114\053","\078\097\109\101 \119\097\115 \109\117\116\097\116\101\100\046")p:AssertSame(t.TestContainer3.TestContainer4.Name,"\084\101\115\116\067\111\110\116\097\105\110\101\114\052","\078\097\109\101 \119\097\115 \099\104\097\110\103\101\100\046")t.Name="\084\101\115\116\067\111\110\116\097\105\110\101\114\054"p:AssertSame(L.Name,"\084\101\115\116\067\111\110\116\097\105\110\101\114\050","\078\097\109\101 \119\097\115 \109\117\116\097\116\101\100\046")p:AssertSame(t.Name,"\084\101\115\116\067\111\110\116\097\105\110\101\114\054","\078\097\109\101 \119\097\115\110\'\116 \099\104\097\110\103\101\100\046")p:AssertSame(t.TestContainer3.CustomProperty1,t.TestContainer3.CustomProperty1,"\080\114\111\112\101\114\116\121 \099\108\111\110\101\100 \105\110\099\111\114\114\101\099\116\108\121\046")p:AssertSame(t.TestContainer3.CustomProperty2,t.TestContainer3.TestContainer4,"\080\114\111\112\101\114\116\121 \099\108\111\110\101\100 \105\110\099\111\114\114\101\099\116\108\121\046")p:AssertSame(t.TestContainer3.CustomProperty3,t,"\080\114\111\112\101\114\116\121 \099\108\111\110\101\100 \105\110\099\111\114\114\101\099\116\108\121\046")p:AssertSame(t.TestContainer3.CustomProperty4,u,"\080\114\111\112\101\114\116\121 \099\108\111\110\101\100 \105\110\099\111\114\114\101\099\116\108\121\046")end)p:RegisterUnitTest("\068\101\115\116\114\111\121",function(p)local u,L,o,F=i()L.Parent=u o.Parent=L F.Parent=o L:Destroy()p:AssertSame(#u:GetChildren(),0,"\067\104\105\108\100\114\101\110 \110\111\116 \099\108\101\097\114\101\100\046")p:AssertSame(#L:GetChildren(),0,"\067\104\105\108\100\114\101\110 \110\111\116 \099\108\101\097\114\101\100\046")p:AssertNil(L.Parent,"\080\097\114\101\110\116 \105\115 \110\111\116 \117\110\115\101\116\046")p:AssertNil(o.Parent,"\080\097\114\101\110\116 \105\115 \110\111\116 \117\110\115\101\116\046")p:AssertNil(F.Parent,"\080\097\114\101\110\116 \105\115 \110\111\116 \117\110\115\101\116\046")p:AssertErrors(function()L.Parent=u end,"\080\097\114\101\110\116 \105\115 \110\111\116 \108\111\099\107\101\100\046")p:AssertErrors(function()o.Parent=u end,"\080\097\114\101\110\116 \105\115 \110\111\116 \108\111\099\107\101\100\046")p:AssertErrors(function()F.Parent=u end,"\080\097\114\101\110\116 \105\115 \110\111\116 \108\111\099\107\101\100\046")end)p:RegisterUnitTest("\070\105\110\100\070\105\114\115\116\065\110\099\101\115\116\111\114",function(p)local u,L,o,F=i()L.Parent=u o.Parent=L F.Parent=o p:AssertSame(u:FindFirstAncestor("\084\101\115\116\067\111\110\116\097\105\110\101\114\049"),nil,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(u:FindFirstAncestor("\084\101\115\116\067\111\110\116\097\105\110\101\114\050"),nil,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(u:FindFirstAncestor("\084\101\115\116\067\111\110\116\097\105\110\101\114\051"),nil,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(u:FindFirstAncestor("\084\101\115\116\067\111\110\116\097\105\110\101\114\052"),nil,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstAncestor("\084\101\115\116\067\111\110\116\097\105\110\101\114\049"),u,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstAncestor("\084\101\115\116\067\111\110\116\097\105\110\101\114\050"),nil,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstAncestor("\084\101\115\116\067\111\110\116\097\105\110\101\114\051"),nil,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstAncestor("\084\101\115\116\067\111\110\116\097\105\110\101\114\052"),nil,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstAncestor("\084\101\115\116\067\111\110\116\097\105\110\101\114\049"),u,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstAncestor("\084\101\115\116\067\111\110\116\097\105\110\101\114\050"),L,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstAncestor("\084\101\115\116\067\111\110\116\097\105\110\101\114\051"),nil,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstAncestor("\084\101\115\116\067\111\110\116\097\105\110\101\114\052"),nil,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstAncestor("\084\101\115\116\067\111\110\116\097\105\110\101\114\049"),u,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstAncestor("\084\101\115\116\067\111\110\116\097\105\110\101\114\050"),L,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstAncestor("\084\101\115\116\067\111\110\116\097\105\110\101\114\051"),o,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstAncestor("\084\101\115\116\067\111\110\116\097\105\110\101\114\052"),nil,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\070\105\110\100\070\105\114\115\116\065\110\099\101\115\116\111\114\079\102\067\108\097\115\115",function(p)local u,L,o,F=i()L.Parent=u o.Parent=L F.Parent=o p:AssertSame(u:FindFirstAncestorOfClass("\078\101\120\117\115\067\111\110\116\097\105\110\101\114"),nil,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstAncestorOfClass("\078\101\120\117\115\067\111\110\116\097\105\110\101\114"),u,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstAncestorOfClass("\078\101\120\117\115\067\111\110\116\097\105\110\101\114"),L,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstAncestorOfClass("\078\101\120\117\115\067\111\110\116\097\105\110\101\114"),o,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\070\105\110\100\070\105\114\115\116\065\110\099\101\115\116\111\114\087\104\105\099\104\073\115\065",function(p)local u,L,o,F=i()L.Parent=u o.Parent=L F.Parent=o p:AssertSame(u:FindFirstAncestorWhichIsA("\078\101\120\117\115\067\111\110\116\097\105\110\101\114"),nil,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(u:FindFirstAncestorWhichIsA("\078\101\120\117\115\073\110\115\116\097\110\099\101"),nil,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(u:FindFirstAncestorWhichIsA("\080\097\114\116"),nil,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstAncestorWhichIsA("\078\101\120\117\115\067\111\110\116\097\105\110\101\114"),u,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstAncestorWhichIsA("\078\101\120\117\115\073\110\115\116\097\110\099\101"),u,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstAncestorWhichIsA("\080\097\114\116"),nil,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstAncestorWhichIsA("\078\101\120\117\115\067\111\110\116\097\105\110\101\114"),L,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstAncestorWhichIsA("\078\101\120\117\115\073\110\115\116\097\110\099\101"),L,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstAncestorWhichIsA("\080\097\114\116"),nil,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstAncestorWhichIsA("\078\101\120\117\115\067\111\110\116\097\105\110\101\114"),o,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstAncestorWhichIsA("\078\101\120\117\115\073\110\115\116\097\110\099\101"),o,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstAncestorWhichIsA("\080\097\114\116"),nil,"\065\110\099\101\115\116\111\114 \105\115 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\070\105\110\100\070\105\114\115\116\067\104\105\108\100",function(p)local u,L,o,F=i()L.Parent=u o.Parent=L F.Parent=o p:AssertSame(u:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\049"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(u:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\050"),L,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(u:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\051"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(u:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\052"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(u:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\049",true),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(u:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\050",true),L,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(u:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\051",true),o,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(u:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\052",true),F,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\049"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\050"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\051"),o,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\052"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\049",true),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\050",true),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\051",true),o,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\052",true),F,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\049"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\050"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\051"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\052"),F,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\049",true),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\050",true),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\051",true),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\052",true),F,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\049"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\050"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\051"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\052"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\049",true),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\050",true),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\051",true),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\052",true),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\070\105\110\100\070\105\114\115\116\067\104\105\108\100\079\102\067\108\097\115\115",function(p)local u,L,o,F=i()L.Parent=u o.Parent=L F.Parent=o p:AssertSame(u:FindFirstChildOfClass("\078\101\120\117\115\067\111\110\116\097\105\110\101\114"),L,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(u:FindFirstChildOfClass("\078\101\120\117\115\067\111\110\116\097\105\110\101\114",true),L,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstChildOfClass("\078\101\120\117\115\067\111\110\116\097\105\110\101\114"),o,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstChildOfClass("\078\101\120\117\115\067\111\110\116\097\105\110\101\114",true),o,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstChildOfClass("\078\101\120\117\115\067\111\110\116\097\105\110\101\114"),F,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstChildOfClass("\078\101\120\117\115\067\111\110\116\097\105\110\101\114",true),F,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstChildOfClass("\078\101\120\117\115\067\111\110\116\097\105\110\101\114"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstChildOfClass("\078\101\120\117\115\067\111\110\116\097\105\110\101\114",true),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\070\105\110\100\070\105\114\115\116\067\104\105\108\100\087\104\105\099\104\073\115\065",function(p)local u,L,o,F=i()L.Parent=u o.Parent=L F.Parent=o p:AssertSame(u:FindFirstChildWhichIsA("\078\101\120\117\115\067\111\110\116\097\105\110\101\114"),L,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(u:FindFirstChildWhichIsA("\078\101\120\117\115\073\110\115\116\097\110\099\101"),L,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(u:FindFirstChildWhichIsA("\080\097\114\116"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(u:FindFirstChildWhichIsA("\078\101\120\117\115\067\111\110\116\097\105\110\101\114",true),L,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstChildWhichIsA("\078\101\120\117\115\067\111\110\116\097\105\110\101\114"),o,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstChildWhichIsA("\078\101\120\117\115\073\110\115\116\097\110\099\101"),o,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstChildWhichIsA("\080\097\114\116"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(L:FindFirstChildWhichIsA("\078\101\120\117\115\067\111\110\116\097\105\110\101\114",true),o,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstChildWhichIsA("\078\101\120\117\115\067\111\110\116\097\105\110\101\114"),F,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstChildWhichIsA("\078\101\120\117\115\073\110\115\116\097\110\099\101"),F,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstChildWhichIsA("\080\097\114\116"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(o:FindFirstChildWhichIsA("\078\101\120\117\115\067\111\110\116\097\105\110\101\114",true),F,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstChildWhichIsA("\078\101\120\117\115\067\111\110\116\097\105\110\101\114"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstChildWhichIsA("\078\101\120\117\115\073\110\115\116\097\110\099\101"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstChildWhichIsA("\080\097\114\116"),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertSame(F:FindFirstChildWhichIsA("\078\101\120\117\115\067\111\110\116\097\105\110\101\114",true),nil,"\067\104\105\108\100 \105\115 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\071\101\116\067\104\105\108\100\114\101\110",function(p)local u,L,F,t=i()L.Parent=u F.Parent=L t.Parent=F o(p,u:GetChildren(),{L},"\067\104\105\108\100\114\101\110 \097\114\101 \105\110\099\111\114\114\101\099\116\046")o(p,L:GetChildren(),{F},"\067\104\105\108\100\114\101\110 \097\114\101 \105\110\099\111\114\114\101\099\116\046")o(p,F:GetChildren(),{t},"\067\104\105\108\100\114\101\110 \097\114\101 \105\110\099\111\114\114\101\099\116\046")o(p,t:GetChildren(),{},"\067\104\105\108\100\114\101\110 \097\114\101 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\071\101\116\068\101\115\099\101\110\100\097\110\116\115",function(p)local u,L,F,t=i()L.Parent=u F.Parent=L t.Parent=F o(p,u:GetDescendants(),{L,F,t},"\067\104\105\108\100\114\101\110 \097\114\101 \105\110\099\111\114\114\101\099\116\046")o(p,L:GetDescendants(),{F;t},"\067\104\105\108\100\114\101\110 \097\114\101 \105\110\099\111\114\114\101\099\116\046")o(p,F:GetDescendants(),{t},"\067\104\105\108\100\114\101\110 \097\114\101 \105\110\099\111\114\114\101\099\116\046")o(p,t:GetDescendants(),{},"\067\104\105\108\100\114\101\110 \097\114\101 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\071\101\116\070\117\108\108\078\097\109\101",function(p)local u,L,o,F=i()L.Parent=u o.Parent=L F.Parent=o p:AssertEquals(u:GetFullName(),"\084\101\115\116\067\111\110\116\097\105\110\101\114\049","\078\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertEquals(L:GetFullName(),"\084\101\115\116\067\111\110\116\097\105\110\101\114\049\046\084\101\115\116\067\111\110\116\097\105\110\101\114\050","\078\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertEquals(o:GetFullName(),"\084\101\115\116\067\111\110\116\097\105\110\101\114\049\046\084\101\115\116\067\111\110\116\097\105\110\101\114\050\046\084\101\115\116\067\111\110\116\097\105\110\101\114\051","\078\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")p:AssertEquals(F:GetFullName(),"\084\101\115\116\067\111\110\116\097\105\110\101\114\049\046\084\101\115\116\067\111\110\116\097\105\110\101\114\050\046\084\101\115\116\067\111\110\116\097\105\110\101\114\051\046\084\101\115\116\067\111\110\116\097\105\110\101\114\052","\078\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")end)p:RegisterUnitTest("\073\115\065\110\099\101\115\116\111\114\079\102",function(p)local u,L,o,F=i()L.Parent=u o.Parent=L F.Parent=o p:AssertEquals(u:IsAncestorOf(u),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")p:AssertEquals(u:IsAncestorOf(L),true,"\065\110\099\101\115\116\114\121 \105\115 \118\097\108\105\100\046")p:AssertEquals(u:IsAncestorOf(o),true,"\065\110\099\101\115\116\114\121 \105\115 \118\097\108\105\100\046")p:AssertEquals(u:IsAncestorOf(F),true,"\065\110\099\101\115\116\114\121 \105\115 \118\097\108\105\100\046")p:AssertEquals(L:IsAncestorOf(u),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")p:AssertEquals(L:IsAncestorOf(L),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")p:AssertEquals(L:IsAncestorOf(o),true,"\065\110\099\101\115\116\114\121 \105\115 \118\097\108\105\100\046")p:AssertEquals(L:IsAncestorOf(F),true,"\065\110\099\101\115\116\114\121 \105\115 \118\097\108\105\100\046")p:AssertEquals(o:IsAncestorOf(u),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")p:AssertEquals(o:IsAncestorOf(L),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")p:AssertEquals(o:IsAncestorOf(o),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")p:AssertEquals(o:IsAncestorOf(F),true,"\065\110\099\101\115\116\114\121 \105\115 \118\097\108\105\100\046")p:AssertEquals(F:IsAncestorOf(u),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")p:AssertEquals(F:IsAncestorOf(L),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")p:AssertEquals(F:IsAncestorOf(o),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")p:AssertEquals(F:IsAncestorOf(F),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")end)p:RegisterUnitTest("\073\115\068\101\115\099\101\110\100\097\110\116\079\102",function(p)local u,L,o,F=i()L.Parent=u o.Parent=L F.Parent=o p:AssertEquals(u:IsDescendantOf(u),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")p:AssertEquals(u:IsDescendantOf(L),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")p:AssertEquals(u:IsDescendantOf(o),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")p:AssertEquals(u:IsDescendantOf(F),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")p:AssertEquals(L:IsDescendantOf(u),true,"\065\110\099\101\115\116\114\121 \105\115 \118\097\108\105\100\046")p:AssertEquals(L:IsDescendantOf(L),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")p:AssertEquals(L:IsDescendantOf(o),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")p:AssertEquals(L:IsDescendantOf(F),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")p:AssertEquals(o:IsDescendantOf(u),true,"\065\110\099\101\115\116\114\121 \105\115 \118\097\108\105\100\046")p:AssertEquals(o:IsDescendantOf(L),true,"\065\110\099\101\115\116\114\121 \105\115 \118\097\108\105\100\046")p:AssertEquals(o:IsDescendantOf(o),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")p:AssertEquals(o:IsDescendantOf(F),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")p:AssertEquals(F:IsDescendantOf(u),true,"\065\110\099\101\115\116\114\121 \105\115 \118\097\108\105\100\046")p:AssertEquals(F:IsDescendantOf(L),true,"\065\110\099\101\115\116\114\121 \105\115 \118\097\108\105\100\046")p:AssertEquals(F:IsDescendantOf(o),true,"\065\110\099\101\115\116\114\121 \105\115 \118\097\108\105\100\046")p:AssertEquals(F:IsDescendantOf(F),false,"\065\110\099\101\115\116\114\121 \105\115 \105\110\118\097\108\105\100\046")end)p:RegisterUnitTest("\087\097\105\116\070\111\114\067\104\105\108\100",function(p)local u,L,o,F=i()L.Parent=u delay(.1,function()o.Parent=L F.Parent=o end)u:WaitForChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\050")L:WaitForChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\051")o:WaitForChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\052")F:WaitForChild("\084\101\115\116\067\111\110\116\097\105\110\101\114\053",.2)end)p:RegisterUnitTest("\067\111\110\110\101\099\116\084\111\072\105\103\104\101\115\116\080\097\114\101\110\116",function(p)local u,L,o,F=i()L.Parent=u F.Parent=L local t F:ConnectToHighestParent("\067\104\097\110\103\101\100",function(p)t=p end)u.Changed:Fire("\084\101\115\116\049")L.Changed:Fire("\084\101\115\116\050")o.Changed:Fire("\084\101\115\116\051")F.Changed:Fire("\084\101\115\116\052")p:AssertEquals(t,"\084\101\115\116\049","\067\111\110\110\101\099\116\101\100 \105\110\118\111\107\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")F.Parent=o u.Changed:Fire("\084\101\115\116\049")L.Changed:Fire("\084\101\115\116\050")o.Changed:Fire("\084\101\115\116\051")F.Changed:Fire("\084\101\115\116\052")p:AssertEquals(t,"\084\101\115\116\051","\067\111\110\110\101\099\116\101\100 \105\110\118\111\107\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")F.Parent=nil u.Changed:Fire("\084\101\115\116\049")L.Changed:Fire("\084\101\115\116\050")o.Changed:Fire("\084\101\115\116\051")F.Changed:Fire("\084\101\115\116\052")p:AssertEquals(t,"\084\101\115\116\052","\067\111\110\110\101\099\116\101\100 \105\110\118\111\107\101 \119\097\115 \105\110\099\111\114\114\101\099\116\046")end)return true
--[[
TheNexusAvenger

Tests the NexusContainer class.
--]]

local NexusUnitTesting = require("NexusUnitTesting")

local NexusPluginFramework = require(game:GetService("ReplicatedStorage"):WaitForChild("NexusPluginFramework"))
local NexusContainer = NexusPluginFramework:GetResource("Base.NexusContainer")



--[[
Creates the components under testing.
--]]
local function Setup()
	local CuT1 = NexusContainer.new()
	local CuT2 = NexusContainer.new()
	local CuT3 = NexusContainer.new()
	local CuT4 = NexusContainer.new()
	
	CuT1.Name = "TestContainer1"
	CuT2.Name = "TestContainer2"
	CuT3.Name = "TestContainer3"
	CuT4.Name = "TestContainer4"
	
	return CuT1,CuT2,CuT3,CuT4
end

--[[
Asserts the contents of a table are the same.
--]]
local function AssertContentsSame(UnitTest,Expected,Actual,Message)
	--If the contents of the expected don't match, fail the test.
	for Key,Value in pairs(Expected) do
		if Value ~= Actual[Key] then
			UnitTest:Fail(Message)
		end
	end
	
	--If the contents of the actual don't match, fail the test.
	for Key,Value in pairs(Actual) do
		if Value ~= Expected[Key] then
			UnitTest:Fail(Message)
		end
	end
end



--[[
Test that the constructor works without failing.
--]]
NexusUnitTesting:RegisterUnitTest("Constructor",function(UnitTest)
	local CuT = NexusContainer.new()
	UnitTest:AssertEquals(CuT.ClassName,"NexusContainer","Class name is incorrect.")
	UnitTest:AssertEquals(CuT.Name,"NexusContainer","Name is incorrect.")
	UnitTest:AssertEquals(tostring(CuT),"NexusContainer","Name is incorrect.")
end)

--[[
Tests indexing children.
--]]
NexusUnitTesting:RegisterUnitTest("Indexing",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	CuT2.Parent = CuT1
	CuT3.Parent = CuT1
	CuT4.Parent = CuT3
	
	--Assert indexing is correct.
	UnitTest:AssertSame(CuT1.TestContainer2,CuT2,"Indexing is incorrect.")
	UnitTest:AssertSame(CuT1.TestContainer3,CuT3,"Indexing is incorrect.")
	UnitTest:AssertSame(CuT1.TestContainer3.TestContainer4,CuT4,"Indexing is incorrect.")
end)

--[[
Tests the Hidden property.
--]]
NexusUnitTesting:RegisterUnitTest("Hidden",function(UnitTest)
	local ChildAddedCount,DescendantAddedCount = 0,0
	
	--Create the components under testing.
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	CuT1.ChildAdded:Connect(function(Child)
		ChildAddedCount = ChildAddedCount + 1
	end)
	CuT1.DescendantAdded:Connect(function(Child)
		DescendantAddedCount = DescendantAddedCount + 1
	end)
	CuT2.Hidden = true
	CuT2.Parent = CuT1
	CuT3.Parent = CuT1
	CuT4.Parent = CuT2
	
	--Assert indexing is correct.
	UnitTest:AssertEquals(ChildAddedCount,1,"ChildAdded fired an incorrect amount of times.")
	UnitTest:AssertEquals(DescendantAddedCount,1,"DescendantAdded fired an incorrect amount of times.")
	AssertContentsSame(UnitTest,CuT1:GetChildren(),{CuT3},"GetChildren is incorrect.")
	AssertContentsSame(UnitTest,CuT1:GetDescendants(),{CuT3},"GetDescendants is incorrect.")
end)

--[[
Test the AncestryChanged event.
--]]
NexusUnitTesting:RegisterUnitTest("AncestryChanged",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	local ChildChanges,ParentChanges = {},{}
	
	--Set up change tracking.
	CuT1.AncestryChanged:Connect(function(Child,Parent)
		table.insert(ChildChanges,Child)
		table.insert(ParentChanges,Parent)
	end)
	
	--Change the parents.
	CuT1.Parent = CuT2
	CuT2.Parent = CuT3
	CuT3.Parent = CuT4
	CuT1.Parent = CuT4
	CuT1.Parent = nil
	
	--Assert the event was fired correctly.
	UnitTest:AssertSame(ChildChanges[1],CuT1,"Change was incorrect.")
	UnitTest:AssertSame(ParentChanges[1],CuT2,"Change was incorrect.")
	UnitTest:AssertSame(ChildChanges[2],CuT2,"Change was incorrect.")
	UnitTest:AssertSame(ParentChanges[2],CuT3,"Change was incorrect.")
	UnitTest:AssertSame(ChildChanges[3],CuT3,"Change was incorrect.")
	UnitTest:AssertSame(ParentChanges[3],CuT4,"Change was incorrect.")
	UnitTest:AssertSame(ChildChanges[4],CuT1,"Change was incorrect.")
	UnitTest:AssertSame(ParentChanges[4],CuT4,"Change was incorrect.")
	UnitTest:AssertSame(ChildChanges[5],CuT1,"Change was incorrect.")
	UnitTest:AssertSame(ParentChanges[5],nil,"Change was incorrect.")
end)

--[[
Test the ChildAdded event.
--]]
NexusUnitTesting:RegisterUnitTest("ChildAdded",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	local AddedChildren = {}
	
	--Set up addition tracking.
	CuT1.ChildAdded:Connect(function(Child)
		table.insert(AddedChildren,Child)
	end)
	
	--Change the parents.
	CuT2.Parent = CuT1
	CuT3.Parent = CuT1
	CuT4.Parent = CuT2
	CuT4.Parent = CuT1
	
	--Assert the event was fired correctly.
	UnitTest:AssertSame(AddedChildren[1],CuT2,"Change was incorrect.")
	UnitTest:AssertSame(AddedChildren[2],CuT3,"Change was incorrect.")
	UnitTest:AssertSame(AddedChildren[3],CuT4,"Change was incorrect.")
	UnitTest:AssertSame(AddedChildren[4],nil,"Change was incorrect.")
end)

--[[
Test the ChildRemoved event.
--]]
NexusUnitTesting:RegisterUnitTest("ChildRemoved",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	local RemovedChildren = {}
	
	--Set up removing tracking.
	CuT1.ChildRemoved:Connect(function(Child)
		table.insert(RemovedChildren,Child)
	end)
	
	--Change the parents.
	CuT2.Parent = CuT1
	CuT3.Parent = CuT1
	CuT4.Parent = CuT2
	CuT3.Parent = CuT2
	CuT2.Parent = nil
	CuT3.Parent = nil
	CuT4.Parent = nil
	
	--Assert the event was fired correctly.
	UnitTest:AssertSame(RemovedChildren[1],CuT3,"Change was incorrect.")
	UnitTest:AssertSame(RemovedChildren[2],CuT2,"Change was incorrect.")
end)

--[[
Test the DescendantAdded event.
--]]
NexusUnitTesting:RegisterUnitTest("DescendantAdded",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	local AddedChildren = {}
	
	--Set up addition tracking.
	CuT1.DescendantAdded:Connect(function(Child)
		table.insert(AddedChildren,Child)
	end)
	
	--Change the parents.
	CuT2.Parent = CuT1
	CuT3.Parent = CuT1
	CuT4.Parent = CuT2
	CuT4.Parent = CuT1
	
	--Assert the event was fired correctly.
	UnitTest:AssertSame(AddedChildren[1],CuT2,"Change was incorrect.")
	UnitTest:AssertSame(AddedChildren[2],CuT3,"Change was incorrect.")
	UnitTest:AssertSame(AddedChildren[3],CuT4,"Change was incorrect.")
	UnitTest:AssertSame(AddedChildren[4],CuT4,"Change was incorrect.")
end)

--[[
Test the DescendantRemoving event.
--]]
NexusUnitTesting:RegisterUnitTest("DescendantRemoving",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	local RemovedChildren = {}
	
	--Set up removing tracking.
	CuT1.DescendantRemoving:Connect(function(Child)
		table.insert(RemovedChildren,Child)
	end)
	
	--Change the parents.
	CuT2.Parent = CuT1
	CuT3.Parent = CuT1
	CuT4.Parent = CuT2
	CuT2.Parent = nil
	CuT3.Parent = nil
	CuT4.Parent = nil
	
	--Assert the event was fired correctly.
	UnitTest:AssertSame(RemovedChildren[1],CuT2,"Change was incorrect.")
	UnitTest:AssertSame(RemovedChildren[2],CuT4,"Change was incorrect.")
	UnitTest:AssertSame(RemovedChildren[3],CuT3,"Change was incorrect.")
	UnitTest:AssertSame(RemovedChildren[4],nil,"Change was incorrect.")
end)

--[[
Tests the ClearAllChildren method.
--]]
NexusUnitTesting:RegisterUnitTest("ClearAllChildren",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	CuT2.Parent = CuT1
	CuT3.Parent = CuT1
	CuT4.Parent = CuT2
	
	--Clear the children.
	CuT1:ClearAllChildren()
	
	--Assert the parents are not set.
	UnitTest:AssertNil(CuT2.Parent,"Parent is still set.")
	UnitTest:AssertNil(CuT3.Parent,"Parent is still set.")
	UnitTest:AssertNil(CuT4.Parent,"Parent is still set.")
	
	--Assert the parents are locked.
	UnitTest:AssertErrors(function()
		CuT2.Parent = CuT1
	end,"Parent is not locked.")
	UnitTest:AssertErrors(function()
		CuT3.Parent = CuT1
	end,"Parent is not locked.")
	UnitTest:AssertErrors(function()
		CuT4.Parent = CuT1
	end,"Parent is not locked.")
end)

--[[
Tests the Clone method.
--]]
NexusUnitTesting:RegisterUnitTest("Clone",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	CuT2.Parent = CuT1
	CuT3.Parent = CuT2
	CuT4.Parent = CuT3
	CuT3.CustomProperty1 = CuT3
	CuT3.CustomProperty2 = CuT4
	CuT3.CustomProperty3 = CuT2
	CuT3.CustomProperty4 = CuT1
	
	--Create a clone.
	local CuT5 = CuT2:Clone()
	UnitTest:AssertNotSame(CuT5,CuT2,"Instance not cloned.")
	UnitTest:AssertNil(CuT5.Parent,"Parent was set.")
	UnitTest:AssertNotNil(CuT5.TestContainer3,"No instance cloned.")
	UnitTest:AssertNotSame(CuT5.TestContainer3,CuT3,"Instance not cloned.")
	UnitTest:AssertNotNil(CuT5.TestContainer3.TestContainer4,"No instanced cloned.")
	UnitTest:AssertNotSame(CuT5.TestContainer3.TestContainer4,"Instance not cloned.")
	
	--Assert the copies aren't muted.
	CuT4.Name = "TestContainer5"
	UnitTest:AssertSame(CuT4.Name,"TestContainer5","Name was mutated.")
	UnitTest:AssertSame(CuT5.TestContainer3.TestContainer4.Name,"TestContainer4","Name was changed.")
	
	--Assert the original doesn't get mutated.
	CuT5.Name = "TestContainer6"
	UnitTest:AssertSame(CuT2.Name,"TestContainer2","Name was mutated.")
	UnitTest:AssertSame(CuT5.Name,"TestContainer6","Name wasn't changed.")
	
	--Assert the properties are properly set.
	UnitTest:AssertSame(CuT5.TestContainer3.CustomProperty1,CuT5.TestContainer3.CustomProperty1,"Property cloned incorrectly.")
	UnitTest:AssertSame(CuT5.TestContainer3.CustomProperty2,CuT5.TestContainer3.TestContainer4,"Property cloned incorrectly.")
	UnitTest:AssertSame(CuT5.TestContainer3.CustomProperty3,CuT5,"Property cloned incorrectly.")
	UnitTest:AssertSame(CuT5.TestContainer3.CustomProperty4,CuT1,"Property cloned incorrectly.")
end)

--[[
Tests the Destroy method.
--]]
NexusUnitTesting:RegisterUnitTest("Destroy",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	CuT2.Parent = CuT1
	CuT3.Parent = CuT2
	CuT4.Parent = CuT3
	
	--Destroy CuT2.
	CuT2:Destroy()
	UnitTest:AssertSame(#CuT1:GetChildren(),0,"Children not cleared.")
	UnitTest:AssertSame(#CuT2:GetChildren(),0,"Children not cleared.")
	
	--Assert the instances are destroyed.
	UnitTest:AssertNil(CuT2.Parent,"Parent is not unset.")
	UnitTest:AssertNil(CuT3.Parent,"Parent is not unset.")
	UnitTest:AssertNil(CuT4.Parent,"Parent is not unset.")
	
	--Assert the parents are locked.
	UnitTest:AssertErrors(function()
		CuT2.Parent = CuT1
	end,"Parent is not locked.")
	UnitTest:AssertErrors(function()
		CuT3.Parent = CuT1
	end,"Parent is not locked.")
	UnitTest:AssertErrors(function()
		CuT4.Parent = CuT1
	end,"Parent is not locked.")
end)

--[[
Tests the FindFirstAncestor method.
--]]
NexusUnitTesting:RegisterUnitTest("FindFirstAncestor",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	CuT2.Parent = CuT1
	CuT3.Parent = CuT2
	CuT4.Parent = CuT3
	
	--Assert the ancestory is correct.
	UnitTest:AssertSame(CuT1:FindFirstAncestor("TestContainer1"),nil,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT1:FindFirstAncestor("TestContainer2"),nil,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT1:FindFirstAncestor("TestContainer3"),nil,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT1:FindFirstAncestor("TestContainer4"),nil,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstAncestor("TestContainer1"),CuT1,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstAncestor("TestContainer2"),nil,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstAncestor("TestContainer3"),nil,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstAncestor("TestContainer4"),nil,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstAncestor("TestContainer1"),CuT1,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstAncestor("TestContainer2"),CuT2,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstAncestor("TestContainer3"),nil,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstAncestor("TestContainer4"),nil,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstAncestor("TestContainer1"),CuT1,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstAncestor("TestContainer2"),CuT2,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstAncestor("TestContainer3"),CuT3,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstAncestor("TestContainer4"),nil,"Ancestor is incorrect.")
end)

--[[
Tests the FindFirstAncestorOfClass method.
--]]
NexusUnitTesting:RegisterUnitTest("FindFirstAncestorOfClass",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	CuT2.Parent = CuT1
	CuT3.Parent = CuT2
	CuT4.Parent = CuT3
	
	--Assert the ancestory is correct.
	UnitTest:AssertSame(CuT1:FindFirstAncestorOfClass("NexusContainer"),nil,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstAncestorOfClass("NexusContainer"),CuT1,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstAncestorOfClass("NexusContainer"),CuT2,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstAncestorOfClass("NexusContainer"),CuT3,"Ancestor is incorrect.")
end)

--[[
Tests the FindFirstAncestorWhichIsA method.
--]]
NexusUnitTesting:RegisterUnitTest("FindFirstAncestorWhichIsA",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	CuT2.Parent = CuT1
	CuT3.Parent = CuT2
	CuT4.Parent = CuT3
	
	--Assert the ancestory is correct.
	UnitTest:AssertSame(CuT1:FindFirstAncestorWhichIsA("NexusContainer"),nil,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT1:FindFirstAncestorWhichIsA("NexusInstance"),nil,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT1:FindFirstAncestorWhichIsA("Part"),nil,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstAncestorWhichIsA("NexusContainer"),CuT1,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstAncestorWhichIsA("NexusInstance"),CuT1,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstAncestorWhichIsA("Part"),nil,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstAncestorWhichIsA("NexusContainer"),CuT2,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstAncestorWhichIsA("NexusInstance"),CuT2,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstAncestorWhichIsA("Part"),nil,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstAncestorWhichIsA("NexusContainer"),CuT3,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstAncestorWhichIsA("NexusInstance"),CuT3,"Ancestor is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstAncestorWhichIsA("Part"),nil,"Ancestor is incorrect.")
end)

--[[
Tests the FindFirstChild method.
--]]
NexusUnitTesting:RegisterUnitTest("FindFirstChild",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	CuT2.Parent = CuT1
	CuT3.Parent = CuT2
	CuT4.Parent = CuT3
	
	--Assert the children are correct.
	UnitTest:AssertSame(CuT1:FindFirstChild("TestContainer1"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT1:FindFirstChild("TestContainer2"),CuT2,"Child is incorrect.")
	UnitTest:AssertSame(CuT1:FindFirstChild("TestContainer3"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT1:FindFirstChild("TestContainer4"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT1:FindFirstChild("TestContainer1",true),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT1:FindFirstChild("TestContainer2",true),CuT2,"Child is incorrect.")
	UnitTest:AssertSame(CuT1:FindFirstChild("TestContainer3",true),CuT3,"Child is incorrect.")
	UnitTest:AssertSame(CuT1:FindFirstChild("TestContainer4",true),CuT4,"Child is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstChild("TestContainer1"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstChild("TestContainer2"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstChild("TestContainer3"),CuT3,"Child is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstChild("TestContainer4"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstChild("TestContainer1",true),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstChild("TestContainer2",true),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstChild("TestContainer3",true),CuT3,"Child is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstChild("TestContainer4",true),CuT4,"Child is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstChild("TestContainer1"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstChild("TestContainer2"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstChild("TestContainer3"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstChild("TestContainer4"),CuT4,"Child is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstChild("TestContainer1",true),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstChild("TestContainer2",true),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstChild("TestContainer3",true),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstChild("TestContainer4",true),CuT4,"Child is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstChild("TestContainer1"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstChild("TestContainer2"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstChild("TestContainer3"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstChild("TestContainer4"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstChild("TestContainer1",true),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstChild("TestContainer2",true),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstChild("TestContainer3",true),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstChild("TestContainer4",true),nil,"Child is incorrect.")
end)

--[[
Tests the FindFirstChildOfClass method.
--]]
NexusUnitTesting:RegisterUnitTest("FindFirstChildOfClass",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	CuT2.Parent = CuT1
	CuT3.Parent = CuT2
	CuT4.Parent = CuT3
	
	--Assert the children are correct.
	UnitTest:AssertSame(CuT1:FindFirstChildOfClass("NexusContainer"),CuT2,"Child is incorrect.")
	UnitTest:AssertSame(CuT1:FindFirstChildOfClass("NexusContainer",true),CuT2,"Child is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstChildOfClass("NexusContainer"),CuT3,"Child is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstChildOfClass("NexusContainer",true),CuT3,"Child is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstChildOfClass("NexusContainer"),CuT4,"Child is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstChildOfClass("NexusContainer",true),CuT4,"Child is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstChildOfClass("NexusContainer"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstChildOfClass("NexusContainer",true),nil,"Child is incorrect.")
end)

--[[
Tests the FindFirstChildOfClass method.
--]]
NexusUnitTesting:RegisterUnitTest("FindFirstChildWhichIsA",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	CuT2.Parent = CuT1
	CuT3.Parent = CuT2
	CuT4.Parent = CuT3
	
	--Assert the children are correct.
	UnitTest:AssertSame(CuT1:FindFirstChildWhichIsA("NexusContainer"),CuT2,"Child is incorrect.")
	UnitTest:AssertSame(CuT1:FindFirstChildWhichIsA("NexusInstance"),CuT2,"Child is incorrect.")
	UnitTest:AssertSame(CuT1:FindFirstChildWhichIsA("Part"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT1:FindFirstChildWhichIsA("NexusContainer",true),CuT2,"Child is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstChildWhichIsA("NexusContainer"),CuT3,"Child is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstChildWhichIsA("NexusInstance"),CuT3,"Child is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstChildWhichIsA("Part"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT2:FindFirstChildWhichIsA("NexusContainer",true),CuT3,"Child is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstChildWhichIsA("NexusContainer"),CuT4,"Child is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstChildWhichIsA("NexusInstance"),CuT4,"Child is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstChildWhichIsA("Part"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT3:FindFirstChildWhichIsA("NexusContainer",true),CuT4,"Child is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstChildWhichIsA("NexusContainer"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstChildWhichIsA("NexusInstance"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstChildWhichIsA("Part"),nil,"Child is incorrect.")
	UnitTest:AssertSame(CuT4:FindFirstChildWhichIsA("NexusContainer",true),nil,"Child is incorrect.")
end)

--[[
Tests the GetChildren method.
--]]
NexusUnitTesting:RegisterUnitTest("GetChildren",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	CuT2.Parent = CuT1
	CuT3.Parent = CuT2
	CuT4.Parent = CuT3
	
	--Assert the children are correct.
	AssertContentsSame(UnitTest,CuT1:GetChildren(),{CuT2},"Children are incorrect.")
	AssertContentsSame(UnitTest,CuT2:GetChildren(),{CuT3},"Children are incorrect.")
	AssertContentsSame(UnitTest,CuT3:GetChildren(),{CuT4},"Children are incorrect.")
	AssertContentsSame(UnitTest,CuT4:GetChildren(),{},"Children are incorrect.")
end)

--[[
Tests the GetDescendants method.
--]]
NexusUnitTesting:RegisterUnitTest("GetDescendants",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	CuT2.Parent = CuT1
	CuT3.Parent = CuT2
	CuT4.Parent = CuT3
	
	--Assert the children are correct.
	AssertContentsSame(UnitTest,CuT1:GetDescendants(),{CuT2,CuT3,CuT4},"Children are incorrect.")
	AssertContentsSame(UnitTest,CuT2:GetDescendants(),{CuT3,CuT4},"Children are incorrect.")
	AssertContentsSame(UnitTest,CuT3:GetDescendants(),{CuT4},"Children are incorrect.")
	AssertContentsSame(UnitTest,CuT4:GetDescendants(),{},"Children are incorrect.")
end)

--[[
Tests the GetFullName method.
--]]
NexusUnitTesting:RegisterUnitTest("GetFullName",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	CuT2.Parent = CuT1
	CuT3.Parent = CuT2
	CuT4.Parent = CuT3
	
	--Assert the children are correct.
	UnitTest:AssertEquals(CuT1:GetFullName(),"TestContainer1","Name is incorrect.")
	UnitTest:AssertEquals(CuT2:GetFullName(),"TestContainer1.TestContainer2","Name is incorrect.")
	UnitTest:AssertEquals(CuT3:GetFullName(),"TestContainer1.TestContainer2.TestContainer3","Name is incorrect.")
	UnitTest:AssertEquals(CuT4:GetFullName(),"TestContainer1.TestContainer2.TestContainer3.TestContainer4","Name is incorrect.")
end)

--[[
Tests the IsAncestorOf method.
--]]
NexusUnitTesting:RegisterUnitTest("IsAncestorOf",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	CuT2.Parent = CuT1
	CuT3.Parent = CuT2
	CuT4.Parent = CuT3
	
	--Assert the ancestry is correct.
	UnitTest:AssertEquals(CuT1:IsAncestorOf(CuT1),false,"Ancestry is invalid.")
	UnitTest:AssertEquals(CuT1:IsAncestorOf(CuT2),true,"Ancestry is valid.")
	UnitTest:AssertEquals(CuT1:IsAncestorOf(CuT3),true,"Ancestry is valid.")
	UnitTest:AssertEquals(CuT1:IsAncestorOf(CuT4),true,"Ancestry is valid.")
	UnitTest:AssertEquals(CuT2:IsAncestorOf(CuT1),false,"Ancestry is invalid.")
	UnitTest:AssertEquals(CuT2:IsAncestorOf(CuT2),false,"Ancestry is invalid.")
	UnitTest:AssertEquals(CuT2:IsAncestorOf(CuT3),true,"Ancestry is valid.")
	UnitTest:AssertEquals(CuT2:IsAncestorOf(CuT4),true,"Ancestry is valid.")
	UnitTest:AssertEquals(CuT3:IsAncestorOf(CuT1),false,"Ancestry is invalid.")
	UnitTest:AssertEquals(CuT3:IsAncestorOf(CuT2),false,"Ancestry is invalid.")
	UnitTest:AssertEquals(CuT3:IsAncestorOf(CuT3),false,"Ancestry is invalid.")
	UnitTest:AssertEquals(CuT3:IsAncestorOf(CuT4),true,"Ancestry is valid.")
	UnitTest:AssertEquals(CuT4:IsAncestorOf(CuT1),false,"Ancestry is invalid.")
	UnitTest:AssertEquals(CuT4:IsAncestorOf(CuT2),false,"Ancestry is invalid.")
	UnitTest:AssertEquals(CuT4:IsAncestorOf(CuT3),false,"Ancestry is invalid.")
	UnitTest:AssertEquals(CuT4:IsAncestorOf(CuT4),false,"Ancestry is invalid.")
end)

--[[
Tests the IsDescendantOf method.
--]]
NexusUnitTesting:RegisterUnitTest("IsDescendantOf",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	CuT2.Parent = CuT1
	CuT3.Parent = CuT2
	CuT4.Parent = CuT3
	
	--Assert the ancestry is correct.
	UnitTest:AssertEquals(CuT1:IsDescendantOf(CuT1),false,"Ancestry is invalid.")
	UnitTest:AssertEquals(CuT1:IsDescendantOf(CuT2),false,"Ancestry is invalid.")
	UnitTest:AssertEquals(CuT1:IsDescendantOf(CuT3),false,"Ancestry is invalid.")
	UnitTest:AssertEquals(CuT1:IsDescendantOf(CuT4),false,"Ancestry is invalid.")
	UnitTest:AssertEquals(CuT2:IsDescendantOf(CuT1),true,"Ancestry is valid.")
	UnitTest:AssertEquals(CuT2:IsDescendantOf(CuT2),false,"Ancestry is invalid.")
	UnitTest:AssertEquals(CuT2:IsDescendantOf(CuT3),false,"Ancestry is invalid.")
	UnitTest:AssertEquals(CuT2:IsDescendantOf(CuT4),false,"Ancestry is invalid.")
	UnitTest:AssertEquals(CuT3:IsDescendantOf(CuT1),true,"Ancestry is valid.")
	UnitTest:AssertEquals(CuT3:IsDescendantOf(CuT2),true,"Ancestry is valid.")
	UnitTest:AssertEquals(CuT3:IsDescendantOf(CuT3),false,"Ancestry is invalid.")
	UnitTest:AssertEquals(CuT3:IsDescendantOf(CuT4),false,"Ancestry is invalid.")
	UnitTest:AssertEquals(CuT4:IsDescendantOf(CuT1),true,"Ancestry is valid.")
	UnitTest:AssertEquals(CuT4:IsDescendantOf(CuT2),true,"Ancestry is valid.")
	UnitTest:AssertEquals(CuT4:IsDescendantOf(CuT3),true,"Ancestry is valid.")
	UnitTest:AssertEquals(CuT4:IsDescendantOf(CuT4),false,"Ancestry is invalid.")
end)

--[[
Tests the WaitForChild method.
--]]
NexusUnitTesting:RegisterUnitTest("WaitForChild",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	CuT2.Parent = CuT1
	
	--Set the parents in a thread.
	delay(0.1,function()
		CuT3.Parent = CuT2
		CuT4.Parent = CuT3
	end)
	
	--Wait for the children or for the timeout.
	CuT1:WaitForChild("TestContainer2")
	CuT2:WaitForChild("TestContainer3")
	CuT3:WaitForChild("TestContainer4")
	CuT4:WaitForChild("TestContainer5",0.2)
end)

--[[
Tests the ConnectToHighestParent method.
--]]
NexusUnitTesting:RegisterUnitTest("ConnectToHighestParent",function(UnitTest)
	local CuT1,CuT2,CuT3,CuT4 = Setup()
	CuT2.Parent = CuT1
	CuT4.Parent = CuT2
	
	--Connect the event.
	local LastInvoke
	CuT4:ConnectToHighestParent("Changed",function(EventData)
		LastInvoke = EventData
	end)
	
	--Invoke the events and assert the event was connected.
	CuT1.Changed:Fire("Test1")
	CuT2.Changed:Fire("Test2")
	CuT3.Changed:Fire("Test3")
	CuT4.Changed:Fire("Test4")
	UnitTest:AssertEquals(LastInvoke,"Test1","Connected invoke was incorrect.")
	
	--Change the parent, invoke the events, and assert the event was connected.
	CuT4.Parent = CuT3
	CuT1.Changed:Fire("Test1")
	CuT2.Changed:Fire("Test2")
	CuT3.Changed:Fire("Test3")
	CuT4.Changed:Fire("Test4")
	UnitTest:AssertEquals(LastInvoke,"Test3","Connected invoke was incorrect.")
	
	--Unparent, invoke the events, and assert the event was connected.
	CuT4.Parent = nil
	CuT1.Changed:Fire("Test1")
	CuT2.Changed:Fire("Test2")
	CuT3.Changed:Fire("Test3")
	CuT4.Changed:Fire("Test4")
	UnitTest:AssertEquals(LastInvoke,"Test4","Connected invoke was incorrect.")
end)


return true