local a=require("\078\101\120\117\115\085\110\105\116\084\101\115\116\105\110\103")local L=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 b=L:GetResource("\066\097\115\101\046\078\101\120\117\115\087\114\097\112\112\101\100\073\110\115\116\097\110\099\101")local Y=L:GetResource("\085\073\046\067\111\110\115\116\114\097\105\110\116\046\078\101\120\117\115\066\111\117\110\100\105\110\103\083\105\122\101\067\111\110\115\116\114\097\105\110\116")a:RegisterUnitTest("\067\111\110\115\116\114\117\099\116\111\114",function(a)local L=Y.new(b.GetInstance("\070\114\097\109\101"))a:AssertEquals(L.ClassName,"\078\101\120\117\115\066\111\117\110\100\105\110\103\083\105\122\101\067\111\110\115\116\114\097\105\110\116","\067\108\097\115\115 \110\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")a:AssertEquals(L.Name,"\078\101\120\117\115\066\111\117\110\100\105\110\103\083\105\122\101\067\111\110\115\116\114\097\105\110\116","\078\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")a:AssertEquals(tostring(L),"\078\101\120\117\115\066\111\117\110\100\105\110\103\083\105\122\101\067\111\110\115\116\114\097\105\110\116","\078\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")a:AssertEquals(#L:GetChildren(),0,"\067\104\105\108\100\114\101\110 \097\114\101\110\'\116 \104\105\100\100\101\110\046")local T=Y.new(Instance.new("\070\114\097\109\101"))a:AssertEquals(T.ClassName,"\078\101\120\117\115\066\111\117\110\100\105\110\103\083\105\122\101\067\111\110\115\116\114\097\105\110\116","\067\108\097\115\115 \110\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")a:AssertEquals(T.Name,"\078\101\120\117\115\066\111\117\110\100\105\110\103\083\105\122\101\067\111\110\115\116\114\097\105\110\116","\078\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")a:AssertEquals(tostring(T),"\078\101\120\117\115\066\111\117\110\100\105\110\103\083\105\122\101\067\111\110\115\116\114\097\105\110\116","\078\097\109\101 \105\115 \105\110\099\111\114\114\101\099\116\046")a:AssertEquals(#T:GetChildren(),0,"\067\104\105\108\100\114\101\110 \097\114\101\110\'\116 \104\105\100\100\101\110\046")end)a:RegisterUnitTest("\066\111\117\110\100\105\110\103\083\105\122\101",function(a)local L=b.GetInstance("\070\114\097\109\101")local T,X,R=b.GetInstance("\070\114\097\109\101"),b.GetInstance("\070\114\097\109\101"),b.GetInstance("\070\114\097\109\101")T.Size=UDim2.new(0,50,0,100)T.Position=UDim2.new(0,20,0,40)T.Parent=L X.Size=UDim2.new(0,100,0,50)X.Position=UDim2.new(0,20,0,50)X.Parent=L R.Size=UDim2.new(0,50,0,50)R.Position=UDim2.new(0,200,0,200)R.Parent=b.GetInstance("\070\114\097\109\101")local A=Y.new(L)a:AssertEquals(L.Size,UDim2.new(0,120,0,140),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")R.Parent=L a:AssertEquals(L.Size,UDim2.new(0,250,0,250),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")T.Size=UDim2.new(0,250,0,250)a:AssertEquals(L.Size,UDim2.new(0,270,0,290),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")X.Position=UDim2.new(0,400,0,400)a:AssertEquals(L.Size,UDim2.new(0,500,0,450),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")X.Parent=nil a:AssertEquals(L.Size,UDim2.new(0,270,0,290),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")T.Visible=false a:AssertEquals(L.Size,UDim2.new(0,250,0,250),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")end)a:RegisterUnitTest("\066\111\117\110\100\105\110\103\083\105\122\101\078\101\115\116\101\100\086\105\115\105\098\108\101\070\114\097\109\101\115",function(a)local L=b.GetInstance("\070\114\097\109\101")local T,X,R=b.GetInstance("\070\114\097\109\101"),b.GetInstance("\070\114\097\109\101"),b.GetInstance("\070\114\097\109\101")T.Size=UDim2.new(0,50,0,100)T.Position=UDim2.new(0,20,0,40)T.Parent=L X.Size=UDim2.new(0,100,0,50)X.Position=UDim2.new(0,20,0,50)X.Parent=T R.Size=UDim2.new(0,50,0,50)R.Position=UDim2.new(0,200,0,200)R.Parent=X local A=Y.new(L)a:AssertEquals(L.Size,UDim2.new(0,290,0,340),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")X.Visible=false a:AssertEquals(L.Size,UDim2.new(0,70,0,140),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")end)a:RegisterUnitTest("\068\101\115\116\114\111\121",function(a)local L=b.GetInstance("\070\114\097\109\101")local T,X,R=b.GetInstance("\070\114\097\109\101"),b.GetInstance("\070\114\097\109\101"),b.GetInstance("\070\114\097\109\101")T.Size=UDim2.new(0,50,0,100)T.Position=UDim2.new(0,20,0,40)T.Parent=L X.Size=UDim2.new(0,100,0,50)X.Position=UDim2.new(0,20,0,50)X.Parent=L R.Size=UDim2.new(0,50,0,50)R.Position=UDim2.new(0,200,0,200)R.Parent=b.GetInstance("\070\114\097\109\101")local A=Y.new(L)a:AssertEquals(L.Size,UDim2.new(0,120,0,140),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")A:Destroy()R.Parent=L a:AssertEquals(L.Size,UDim2.new(0,120,0,140),"\083\105\122\101 \099\104\097\110\103\101\100\046")T.Size=UDim2.new(0,250,0,250)a:AssertEquals(L.Size,UDim2.new(0,120,0,140),"\083\105\122\101 \099\104\097\110\103\101\100\046")X.Position=UDim2.new(0,400,0,400)a:AssertEquals(L.Size,UDim2.new(0,120,0,140),"\083\105\122\101 \099\104\097\110\103\101\100\046")X.Parent=nil a:AssertEquals(L.Size,UDim2.new(0,120,0,140),"\083\105\122\101 \099\104\097\110\103\101\100\046")end)a:RegisterUnitTest("\083\105\122\101\088\079\118\101\114\114\105\100\101",function(a)local L=b.GetInstance("\070\114\097\109\101")local T,X,R=b.GetInstance("\070\114\097\109\101"),b.GetInstance("\070\114\097\109\101"),b.GetInstance("\070\114\097\109\101")T.Size=UDim2.new(0,50,0,100)T.Position=UDim2.new(0,20,0,40)T.Parent=L X.Size=UDim2.new(0,100,0,50)X.Position=UDim2.new(0,20,0,50)X.Parent=L R.Size=UDim2.new(0,50,0,50)R.Position=UDim2.new(0,200,0,200)R.Parent=b.GetInstance("\070\114\097\109\101")local A=Y.new(L)a:AssertEquals(L.Size,UDim2.new(0,120,0,140),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")A.SizeXOverride=UDim.new(.2,240)a:AssertEquals(L.Size,UDim2.new(.2,240,0,140),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")R.Parent=L a:AssertEquals(L.Size,UDim2.new(.2,240,0,250),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")T.Size=UDim2.new(0,250,0,250)a:AssertEquals(L.Size,UDim2.new(.2,240,0,290),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")X.Position=UDim2.new(0,400,0,400)a:AssertEquals(L.Size,UDim2.new(.2,240,0,450),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")X.Parent=nil a:AssertEquals(L.Size,UDim2.new(.2,240,0,290),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")A.SizeXOverride=nil a:AssertEquals(L.Size,UDim2.new(0,270,0,290),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")end)a:RegisterUnitTest("\083\105\122\101\089\079\118\101\114\114\105\100\101",function(a)local L=b.GetInstance("\070\114\097\109\101")local T,X,R=b.GetInstance("\070\114\097\109\101"),b.GetInstance("\070\114\097\109\101"),b.GetInstance("\070\114\097\109\101")T.Size=UDim2.new(0,50,0,100)T.Position=UDim2.new(0,20,0,40)T.Parent=L X.Size=UDim2.new(0,100,0,50)X.Position=UDim2.new(0,20,0,50)X.Parent=L R.Size=UDim2.new(0,50,0,50)R.Position=UDim2.new(0,200,0,200)R.Parent=b.GetInstance("\070\114\097\109\101")local A=Y.new(L)a:AssertEquals(L.Size,UDim2.new(0,120,0,140),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")A.SizeYOverride=UDim.new(.2,240)a:AssertEquals(L.Size,UDim2.new(0,120,.2,240),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")R.Parent=L a:AssertEquals(L.Size,UDim2.new(0,250,.2,240),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")T.Size=UDim2.new(0,250,0,250)a:AssertEquals(L.Size,UDim2.new(0,270,.2,240),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")X.Position=UDim2.new(0,400,0,400)a:AssertEquals(L.Size,UDim2.new(0,500,.2,240),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")X.Parent=nil a:AssertEquals(L.Size,UDim2.new(0,270,.2,240),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")A.SizeYOverride=nil a:AssertEquals(L.Size,UDim2.new(0,270,0,290),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")end)a:RegisterUnitTest("\083\105\122\101\088\079\118\101\114\114\105\100\101\065\110\100\083\105\122\101\089\079\118\101\114\114\105\100\101",function(a)local L=b.GetInstance("\070\114\097\109\101")local T,X,R=b.GetInstance("\070\114\097\109\101"),b.GetInstance("\070\114\097\109\101"),b.GetInstance("\070\114\097\109\101")T.Size=UDim2.new(0,50,0,100)T.Position=UDim2.new(0,20,0,40)T.Parent=L X.Size=UDim2.new(0,100,0,50)X.Position=UDim2.new(0,20,0,50)X.Parent=L R.Size=UDim2.new(0,50,0,50)R.Position=UDim2.new(0,200,0,200)R.Parent=b.GetInstance("\070\114\097\109\101")local A=Y.new(L)a:AssertEquals(L.Size,UDim2.new(0,120,0,140),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")A.SizeXOverride=UDim.new(.1,120)a:AssertEquals(L.Size,UDim2.new(.1,120,0,140),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")A.SizeYOverride=UDim.new(.2,240)a:AssertEquals(L.Size,UDim2.new(.1,120,.2,240),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")R.Parent=L a:AssertEquals(L.Size,UDim2.new(.1,120,.2,240),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")T.Size=UDim2.new(0,250,0,250)a:AssertEquals(L.Size,UDim2.new(.1,120,.2,240),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")X.Position=UDim2.new(0,400,0,400)a:AssertEquals(L.Size,UDim2.new(.1,120,.2,240),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")X.Parent=nil a:AssertEquals(L.Size,UDim2.new(.1,120,.2,240),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")A.SizeXOverride=nil a:AssertEquals(L.Size,UDim2.new(0,270,.2,240),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")A.SizeYOverride=nil a:AssertEquals(L.Size,UDim2.new(0,270,0,290),"\083\105\122\101 \110\111\116 \099\111\114\114\101\099\116\046")end)return true
--[[
TheNexusAvenger

Tests the NexusBoundingSizeConstraint class.
--]]

local NexusUnitTesting = require("NexusUnitTesting")

local NexusPluginFramework = require(game:GetService("ReplicatedStorage"):WaitForChild("NexusPluginFramework"))
local NexusWrappedInstance = NexusPluginFramework:GetResource("Base.NexusWrappedInstance")
local NexusBoundingSizeConstraint = NexusPluginFramework:GetResource("UI.Constraint.NexusBoundingSizeConstraint")



--[[
Test that the constructor works without failing.
--]]
NexusUnitTesting:RegisterUnitTest("Constructor",function(UnitTest)
	--Assert a wrapped instance works.
	local CuT = NexusBoundingSizeConstraint.new(NexusWrappedInstance.GetInstance("Frame"))
	UnitTest:AssertEquals(CuT.ClassName,"NexusBoundingSizeConstraint","Class name is incorrect.")
	UnitTest:AssertEquals(CuT.Name,"NexusBoundingSizeConstraint","Name is incorrect.")
	UnitTest:AssertEquals(tostring(CuT),"NexusBoundingSizeConstraint","Name is incorrect.")
	UnitTest:AssertEquals(#CuT:GetChildren(),0,"Children aren't hidden.")
	
	--Assert a Roblox instance works.
	local CuT = NexusBoundingSizeConstraint.new(Instance.new("Frame"))
	UnitTest:AssertEquals(CuT.ClassName,"NexusBoundingSizeConstraint","Class name is incorrect.")
	UnitTest:AssertEquals(CuT.Name,"NexusBoundingSizeConstraint","Name is incorrect.")
	UnitTest:AssertEquals(tostring(CuT),"NexusBoundingSizeConstraint","Name is incorrect.")
	UnitTest:AssertEquals(#CuT:GetChildren(),0,"Children aren't hidden.")
end)

--[[
Tests that the bounding size with regular frames is correct.
--]]
NexusUnitTesting:RegisterUnitTest("BoundingSize",function(UnitTest)
	--Create a test frame with contents.
	local ContainerFrame = NexusWrappedInstance.GetInstance("Frame")
	local SubFrame1,SubFrame2,SubFrame3 = NexusWrappedInstance.GetInstance("Frame"),NexusWrappedInstance.GetInstance("Frame"),NexusWrappedInstance.GetInstance("Frame")
	SubFrame1.Size = UDim2.new(0,50,0,100)
	SubFrame1.Position = UDim2.new(0,20,0,40)
	SubFrame1.Parent = ContainerFrame
	SubFrame2.Size = UDim2.new(0,100,0,50)
	SubFrame2.Position = UDim2.new(0,20,0,50)
	SubFrame2.Parent = ContainerFrame
	SubFrame3.Size = UDim2.new(0,50,0,50)
	SubFrame3.Position = UDim2.new(0,200,0,200)
	SubFrame3.Parent = NexusWrappedInstance.GetInstance("Frame")
	
	--Create the constraint and assert the size is correct.
	local CuT = NexusBoundingSizeConstraint.new(ContainerFrame)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,120,0,140),"Size not correct.")
	
	--Assert adding a new frame changes the size.
	SubFrame3.Parent = ContainerFrame
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,250,0,250),"Size not correct.")
	
	--Assert changing the size changes the bounding size.
	SubFrame1.Size = UDim2.new(0,250,0,250)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,270,0,290),"Size not correct.")
	
	--Assert changing the position changes the bounding size.
	SubFrame2.Position = UDim2.new(0,400,0,400)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,500,0,450),"Size not correct.")
	
	--Assert removing a frame changes the bounding size.
	SubFrame2.Parent = nil
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,270,0,290),"Size not correct.")
	
	--Assert hiding a frame changes the bounding size.
	SubFrame1.Visible = false
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,250,0,250),"Size not correct.")
end)

--[[
Tests the bounding size with visible frames in inivisble frames
--]]
NexusUnitTesting:RegisterUnitTest("BoundingSizeNestedVisibleFrames",function(UnitTest)
	--Create a test frame with contents.
	local ContainerFrame = NexusWrappedInstance.GetInstance("Frame")
	local SubFrame1,SubFrame2,SubFrame3 = NexusWrappedInstance.GetInstance("Frame"),NexusWrappedInstance.GetInstance("Frame"),NexusWrappedInstance.GetInstance("Frame")
	SubFrame1.Size = UDim2.new(0,50,0,100)
	SubFrame1.Position = UDim2.new(0,20,0,40)
	SubFrame1.Parent = ContainerFrame
	SubFrame2.Size = UDim2.new(0,100,0,50)
	SubFrame2.Position = UDim2.new(0,20,0,50)
	SubFrame2.Parent = SubFrame1
	SubFrame3.Size = UDim2.new(0,50,0,50)
	SubFrame3.Position = UDim2.new(0,200,0,200)
	SubFrame3.Parent = SubFrame2
	
	--Create the constraint and assert the size is correct.
	local CuT = NexusBoundingSizeConstraint.new(ContainerFrame)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,290,0,340),"Size not correct.")
	
	--Assert hiding frame 2 changes the bounding size.
	SubFrame2.Visible = false
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,70,0,140),"Size not correct.")
end)

--[[
Tests the Destroy method.
--]]
NexusUnitTesting:RegisterUnitTest("Destroy",function(UnitTest)
	--Create a test frame with contents.
	local ContainerFrame = NexusWrappedInstance.GetInstance("Frame")
	local SubFrame1,SubFrame2,SubFrame3 = NexusWrappedInstance.GetInstance("Frame"),NexusWrappedInstance.GetInstance("Frame"),NexusWrappedInstance.GetInstance("Frame")
	SubFrame1.Size = UDim2.new(0,50,0,100)
	SubFrame1.Position = UDim2.new(0,20,0,40)
	SubFrame1.Parent = ContainerFrame
	SubFrame2.Size = UDim2.new(0,100,0,50)
	SubFrame2.Position = UDim2.new(0,20,0,50)
	SubFrame2.Parent = ContainerFrame
	SubFrame3.Size = UDim2.new(0,50,0,50)
	SubFrame3.Position = UDim2.new(0,200,0,200)
	SubFrame3.Parent = NexusWrappedInstance.GetInstance("Frame")
	
	--Create the constraint and assert the size is correct.
	local CuT = NexusBoundingSizeConstraint.new(ContainerFrame)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,120,0,140),"Size not correct.")
	CuT:Destroy()
	
	--Assert adding a new frame after destorying doesn't change the size.
	SubFrame3.Parent = ContainerFrame
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,120,0,140),"Size changed.")
	
	--Assert changing the size after destorying doesn't change the bounding size.
	SubFrame1.Size = UDim2.new(0,250,0,250)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,120,0,140),"Size changed.")
	
	--Assert changing the position after destorying doesn't change the bounding size.
	SubFrame2.Position = UDim2.new(0,400,0,400)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,120,0,140),"Size changed.")
	
	--Assert removing a frame after destorying doesn't change the bounding size.
	SubFrame2.Parent = nil
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,120,0,140),"Size changed.")
end)

--[[
Tests the SizeXOverride property.
--]]
NexusUnitTesting:RegisterUnitTest("SizeXOverride",function(UnitTest)
	--Create a test frame with contents.
	local ContainerFrame = NexusWrappedInstance.GetInstance("Frame")
	local SubFrame1,SubFrame2,SubFrame3 = NexusWrappedInstance.GetInstance("Frame"),NexusWrappedInstance.GetInstance("Frame"),NexusWrappedInstance.GetInstance("Frame")
	SubFrame1.Size = UDim2.new(0,50,0,100)
	SubFrame1.Position = UDim2.new(0,20,0,40)
	SubFrame1.Parent = ContainerFrame
	SubFrame2.Size = UDim2.new(0,100,0,50)
	SubFrame2.Position = UDim2.new(0,20,0,50)
	SubFrame2.Parent = ContainerFrame
	SubFrame3.Size = UDim2.new(0,50,0,50)
	SubFrame3.Position = UDim2.new(0,200,0,200)
	SubFrame3.Parent = NexusWrappedInstance.GetInstance("Frame")
	
	--Create the constraint and assert the size is correct.
	local CuT = NexusBoundingSizeConstraint.new(ContainerFrame)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,120,0,140),"Size not correct.")
	
	--Assert setting the SizeXOverride overrides the size.
	CuT.SizeXOverride = UDim.new(0.2,240)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0.2,240,0,140),"Size not correct.")
	
	--Assert adding a new frame after destorying doesn't change the size.
	SubFrame3.Parent = ContainerFrame
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0.2,240,0,250),"Size not correct.")
	
	--Assert changing the size after destorying doesn't change the bounding size.
	SubFrame1.Size = UDim2.new(0,250,0,250)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0.2,240,0,290),"Size not correct.")
	
	--Assert changing the position after destorying doesn't change the bounding size.
	SubFrame2.Position = UDim2.new(0,400,0,400)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0.2,240,0,450),"Size not correct.")
	
	--Assert removing a frame after destorying doesn't change the bounding size.
	SubFrame2.Parent = nil
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0.2,240,0,290),"Size not correct.")
	
	--Assert unsetting the SizeXOverride changes the size.
	CuT.SizeXOverride = nil
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,270,0,290),"Size not correct.")
end)

--[[
Tests the SizeYOverride property.
--]]
NexusUnitTesting:RegisterUnitTest("SizeYOverride",function(UnitTest)
	--Create a test frame with contents.
	local ContainerFrame = NexusWrappedInstance.GetInstance("Frame")
	local SubFrame1,SubFrame2,SubFrame3 = NexusWrappedInstance.GetInstance("Frame"),NexusWrappedInstance.GetInstance("Frame"),NexusWrappedInstance.GetInstance("Frame")
	SubFrame1.Size = UDim2.new(0,50,0,100)
	SubFrame1.Position = UDim2.new(0,20,0,40)
	SubFrame1.Parent = ContainerFrame
	SubFrame2.Size = UDim2.new(0,100,0,50)
	SubFrame2.Position = UDim2.new(0,20,0,50)
	SubFrame2.Parent = ContainerFrame
	SubFrame3.Size = UDim2.new(0,50,0,50)
	SubFrame3.Position = UDim2.new(0,200,0,200)
	SubFrame3.Parent = NexusWrappedInstance.GetInstance("Frame")
	
	--Create the constraint and assert the size is correct.
	local CuT = NexusBoundingSizeConstraint.new(ContainerFrame)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,120,0,140),"Size not correct.")
	
	--Assert setting the SizeYOverride overrides the size.
	CuT.SizeYOverride = UDim.new(0.2,240)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,120,0.2,240),"Size not correct.")
	
	--Assert adding a new frame changes the size.
	SubFrame3.Parent = ContainerFrame
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,250,0.2,240),"Size not correct.")
	
	--Assert changing the size changes the bounding size.
	SubFrame1.Size = UDim2.new(0,250,0,250)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,270,0.2,240),"Size not correct.")
	
	--Assert changing the position changes the bounding size.
	SubFrame2.Position = UDim2.new(0,400,0,400)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,500,0.2,240),"Size not correct.")
	
	--Assert removing a frame changes the bounding size.
	SubFrame2.Parent = nil
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,270,0.2,240),"Size not correct.")
	
	--Assert unsetting the SizeYOverride changes the size.
	CuT.SizeYOverride = nil
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,270,0,290),"Size not correct.")
end)

--[[
Tests the SizeXOverride and SizeYOverride properties together.
--]]
NexusUnitTesting:RegisterUnitTest("SizeXOverrideAndSizeYOverride",function(UnitTest)
	--Create a test frame with contents.
	local ContainerFrame = NexusWrappedInstance.GetInstance("Frame")
	local SubFrame1,SubFrame2,SubFrame3 = NexusWrappedInstance.GetInstance("Frame"),NexusWrappedInstance.GetInstance("Frame"),NexusWrappedInstance.GetInstance("Frame")
	SubFrame1.Size = UDim2.new(0,50,0,100)
	SubFrame1.Position = UDim2.new(0,20,0,40)
	SubFrame1.Parent = ContainerFrame
	SubFrame2.Size = UDim2.new(0,100,0,50)
	SubFrame2.Position = UDim2.new(0,20,0,50)
	SubFrame2.Parent = ContainerFrame
	SubFrame3.Size = UDim2.new(0,50,0,50)
	SubFrame3.Position = UDim2.new(0,200,0,200)
	SubFrame3.Parent = NexusWrappedInstance.GetInstance("Frame")
	
	--Create the constraint and assert the size is correct.
	local CuT = NexusBoundingSizeConstraint.new(ContainerFrame)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,120,0,140),"Size not correct.")
	
	--Assert setting the SizeXOverride and SizeYOverride overrides the size.
	CuT.SizeXOverride = UDim.new(0.1,120)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0.1,120,0,140),"Size not correct.")
	CuT.SizeYOverride = UDim.new(0.2,240)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0.1,120,0.2,240),"Size not correct.")
	
	--Assert adding a new frame changes the size.
	SubFrame3.Parent = ContainerFrame
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0.1,120,0.2,240),"Size not correct.")
	
	--Assert changing the size changes the bounding size.
	SubFrame1.Size = UDim2.new(0,250,0,250)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0.1,120,0.2,240),"Size not correct.")
	
	--Assert changing the position changes the bounding size.
	SubFrame2.Position = UDim2.new(0,400,0,400)
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0.1,120,0.2,240),"Size not correct.")
	
	--Assert removing a frame changes the bounding size.
	SubFrame2.Parent = nil
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0.1,120,0.2,240),"Size not correct.")
	
	--Assert unsetting the SizeYOverride and SizeYOverride changes the size.
	CuT.SizeXOverride = nil
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,270,0.2,240),"Size not correct.")
	CuT.SizeYOverride = nil
	UnitTest:AssertEquals(ContainerFrame.Size,UDim2.new(0,270,0,290),"Size not correct.")
end)



return true