local I=require("\078\101\120\117\115\085\110\105\116\084\101\115\116\105\110\103")local y=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\114\111\106\101\099\116"))local function g()local I=Instance.new("\070\111\108\100\101\114")I.Name="\070\111\108\100\101\114\049"local g=Instance.new("\077\111\100\117\108\101\083\099\114\105\112\116")g.Name="\077\111\100\117\108\101\083\099\114\105\112\116\049\065"g.Source="\114\101\116\117\114\110 \"\084\101\115\116 \049\""g.Parent=I local n=Instance.new("\070\111\108\100\101\114")n.Name="\070\111\108\100\101\114\049\065"n.Parent=I local b=Instance.new("\070\111\108\100\101\114")b.Name="\070\111\108\100\101\114\049\066"b.Parent=n local G=Instance.new("\077\111\100\117\108\101\083\099\114\105\112\116")G.Name="\077\111\100\117\108\101\083\099\114\105\112\116\049\066"G.Source="\114\101\116\117\114\110 \"\084\101\115\116 \050\""G.Parent=b local z=Instance.new("\070\111\108\100\101\114")z.Name="\070\111\108\100\101\114\050"local a=Instance.new("\077\111\100\117\108\101\083\099\114\105\112\116")a.Name="\077\111\100\117\108\101\083\099\114\105\112\116\050\065"a.Source="\114\101\116\117\114\110 \"\084\101\115\116 \051\""a.Parent=z local m=Instance.new("\070\111\108\100\101\114")m.Name="\070\111\108\100\101\114\051"local A=Instance.new("\070\111\108\100\101\114")A.Name="\070\111\108\100\101\114\051\065"A.Parent=m local S=Instance.new("\077\111\100\117\108\101\083\099\114\105\112\116")S.Name="\077\111\100\117\108\101\083\099\114\105\112\116\051\065"S.Source="\114\101\116\117\114\110 \"\084\101\115\116 \052\""S.Parent=A local P=Instance.new("\077\111\100\117\108\101\083\099\114\105\112\116")P.Name="\077\111\100\117\108\101\083\099\114\105\112\116\051\066"P.Source="\119\097\105\116\040\048\046\049\041 \114\101\116\117\114\110 \"\084\101\115\116 \053\""P.Parent=A local E=y.new(I)E:CreatePathLink("\084\101\115\116\049",z)E:CreatePathLink("\084\101\115\116\050",m)return E,I,z,m end I:RegisterUnitTest("\073\115\076\111\097\100\105\110\103",function(I)local y,n,b,G=g();(coroutine.wrap(function()y:GetResource("\084\101\115\116\050\046\070\111\108\100\101\114\051\065\046\077\111\100\117\108\101\083\099\114\105\112\116\051\066")end))()wait()I:AssertTrue(y:IsLoading("\084\101\115\116\050\046\070\111\108\100\101\114\051\065\046\077\111\100\117\108\101\083\099\114\105\112\116\051\066"),"\082\101\115\111\117\114\099\101 \105\115 \108\111\097\100\101\100\046")wait(.1)I:AssertFalse(y:IsLoading("\084\101\115\116\050\046\070\111\108\100\101\114\051\065\046\077\111\100\117\108\101\083\099\114\105\112\116\051\066"),"\082\101\115\111\117\114\099\101 \105\115 \110\111\116 \108\111\097\100\101\100\046")I:AssertEquals(y:GetResource("\084\101\115\116\050\046\070\111\108\100\101\114\051\065\046\077\111\100\117\108\101\083\099\114\105\112\116\051\066"),"\084\101\115\116 \053","\082\101\115\111\117\114\099\101 \105\115 \105\110\099\111\114\114\101\099\116\046")end)I:RegisterUnitTest("\073\115\073\110\115\116\097\110\099\101\073\110\080\097\116\104",function(I)local y,n,b,G=g()I:AssertTrue(y:IsInstanceInPath(n))I:AssertTrue(y:IsInstanceInPath(n.ModuleScript1A))I:AssertTrue(y:IsInstanceInPath(n.Folder1A))I:AssertTrue(y:IsInstanceInPath(n.Folder1A.Folder1B))I:AssertTrue(y:IsInstanceInPath(n.Folder1A.Folder1B.ModuleScript1B))I:AssertTrue(y:IsInstanceInPath(b))I:AssertTrue(y:IsInstanceInPath(b.ModuleScript2A))I:AssertTrue(y:IsInstanceInPath(G))I:AssertTrue(y:IsInstanceInPath(G.Folder3A))I:AssertTrue(y:IsInstanceInPath(G.Folder3A.ModuleScript3A))I:AssertFalse(y:IsInstanceInPath(game:GetService("\087\111\114\107\115\112\097\099\101")))end)I:RegisterUnitTest("\073\115\082\101\115\111\117\114\099\101\067\121\099\108\105\099",function(I)local g=y.new(script)g:__AddInternalDependency("\084\101\115\116\049","\084\101\115\116\050")g:__AddInternalDependency("\084\101\115\116\049","\084\101\115\116\051")g:__AddInternalDependency("\084\101\115\116\050","\084\101\115\116\052")g:__AddInternalDependency("\084\101\115\116\051","\084\101\115\116\050")g:__AddInternalDependency("\084\101\115\116\052","\084\101\115\116\053")g:__AddInternalDependency("\084\101\115\116\053","\084\101\115\116\049")g:__AddInternalDependency("\084\101\115\116\053","\084\101\115\116\054")I:AssertTrue(g:IsResourceCyclic("\084\101\115\116\049"),"\084\101\115\116\049 \105\115\110\'\116 \099\121\099\108\105\099\046")I:AssertTrue(g:IsResourceCyclic("\084\101\115\116\050"),"\084\101\115\116\050 \105\115\110\'\116 \099\121\099\108\105\099\046")I:AssertTrue(g:IsResourceCyclic("\084\101\115\116\051"),"\084\101\115\116\051 \105\115\110\'\116 \099\121\099\108\105\099\046")I:AssertTrue(g:IsResourceCyclic("\084\101\115\116\052"),"\084\101\115\116\052 \105\115\110\'\116 \099\121\099\108\105\099\046")I:AssertTrue(g:IsResourceCyclic("\084\101\115\116\053"),"\084\101\115\116\053 \105\115\110\'\116 \099\121\099\108\105\099\046")I:AssertFalse(g:IsResourceCyclic("\084\101\115\116\054"),"\084\101\115\116\054 \105\115 \099\121\099\108\105\099\046")I:AssertFalse(g:IsResourceCyclic("\084\101\115\116\055"),"\084\101\115\116\055 \105\115 \099\121\099\108\105\099\046")end)I:RegisterUnitTest("\071\101\116\080\097\116\104\070\114\111\109\073\110\115\116\097\110\099\101",function(I)local y,n,b,G=g()I:AssertEquals(y:GetPathFromInstance(n),"")I:AssertEquals(y:GetPathFromInstance(n.ModuleScript1A),"\077\111\100\117\108\101\083\099\114\105\112\116\049\065")I:AssertEquals(y:GetPathFromInstance(n.Folder1A),"\070\111\108\100\101\114\049\065")I:AssertEquals(y:GetPathFromInstance(n.Folder1A.Folder1B),"\070\111\108\100\101\114\049\065\046\070\111\108\100\101\114\049\066")I:AssertEquals(y:GetPathFromInstance(n.Folder1A.Folder1B.ModuleScript1B),"\070\111\108\100\101\114\049\065\046\070\111\108\100\101\114\049\066\046\077\111\100\117\108\101\083\099\114\105\112\116\049\066")I:AssertEquals(y:GetPathFromInstance(b),"\084\101\115\116\049")I:AssertEquals(y:GetPathFromInstance(b.ModuleScript2A),"\084\101\115\116\049\046\077\111\100\117\108\101\083\099\114\105\112\116\050\065")I:AssertEquals(y:GetPathFromInstance(G),"\084\101\115\116\050")I:AssertEquals(y:GetPathFromInstance(G.Folder3A),"\084\101\115\116\050\046\070\111\108\100\101\114\051\065")I:AssertEquals(y:GetPathFromInstance(G.Folder3A.ModuleScript3A),"\084\101\115\116\050\046\070\111\108\100\101\114\051\065\046\077\111\100\117\108\101\083\099\114\105\112\116\051\065")I:AssertErrors(function()y:GetPathFromInstance(game:GetService("\087\111\114\107\115\112\097\099\101"))end)end)I:RegisterUnitTest("\071\101\116\068\101\112\101\110\100\101\110\099\121\080\097\116\104",function(I)local g=y.new(script)g:__AddInternalDependency("\084\101\115\116\049","\084\101\115\116\050")g:__AddInternalDependency("\084\101\115\116\049","\084\101\115\116\051")g:__AddInternalDependency("\084\101\115\116\050","\084\101\115\116\052")g:__AddInternalDependency("\084\101\115\116\051","\084\101\115\116\050")g:__AddInternalDependency("\084\101\115\116\052","\084\101\115\116\053")g:__AddInternalDependency("\084\101\115\116\053","\084\101\115\116\049")g:__AddInternalDependency("\084\101\115\116\053","\084\101\115\116\054")I:AssertEquals(g:GetDependencyPath("\084\101\115\116\049","\084\101\115\116\051"),{"\084\101\115\116\049";"\084\101\115\116\051"},"\080\097\116\104 \105\115 \105\110\099\111\114\114\101\099\116\046")I:AssertEquals(g:GetDependencyPath("\084\101\115\116\049","\084\101\115\116\049"),{"\084\101\115\116\049";"\084\101\115\116\050","\084\101\115\116\052";"\084\101\115\116\053";"\084\101\115\116\049"},"\080\097\116\104 \105\115 \105\110\099\111\114\114\101\099\116\046")I:AssertEquals(g:GetDependencyPath("\084\101\115\116\050","\084\101\115\116\050"),{"\084\101\115\116\050","\084\101\115\116\052";"\084\101\115\116\053","\084\101\115\116\049","\084\101\115\116\050"},"\080\097\116\104 \105\115 \105\110\099\111\114\114\101\099\116\046")I:AssertEquals(g:GetDependencyPath("\084\101\115\116\051","\084\101\115\116\051"),{"\084\101\115\116\051","\084\101\115\116\050";"\084\101\115\116\052";"\084\101\115\116\053";"\084\101\115\116\049","\084\101\115\116\051"},"\080\097\116\104 \105\115 \105\110\099\111\114\114\101\099\116\046")I:AssertEquals(g:GetDependencyPath("\084\101\115\116\052","\084\101\115\116\052"),{"\084\101\115\116\052","\084\101\115\116\053","\084\101\115\116\049";"\084\101\115\116\050";"\084\101\115\116\052"},"\080\097\116\104 \105\115 \105\110\099\111\114\114\101\099\116\046")I:AssertEquals(g:GetDependencyPath("\084\101\115\116\053","\084\101\115\116\053"),{"\084\101\115\116\053";"\084\101\115\116\049","\084\101\115\116\050";"\084\101\115\116\052","\084\101\115\116\053"},"\080\097\116\104 \105\115 \105\110\099\111\114\114\101\099\116\046")I:AssertNil(g:GetDependencyPath("\084\101\115\116\049","\084\101\115\116\055"),"\080\097\116\104 \101\120\105\115\116\115\046")I:AssertNil(g:GetDependencyPath("\084\101\115\116\054","\084\101\115\116\054"),"\080\097\116\104 \101\120\105\115\116\115\046")I:AssertNil(g:GetDependencyPath("\084\101\115\116\055","\084\101\115\116\055"),"\080\097\116\104 \101\120\105\115\116\115\046")end)I:RegisterUnitTest("\071\101\116\067\111\110\116\101\120\116",function(I)local y,n,b,G=g()local z=y:GetContext(script)I:AssertEquals(z:GetResource("\070\111\108\100\101\114\049\065\046\070\111\108\100\101\114\049\066\046\077\111\100\117\108\101\083\099\114\105\112\116\049\066"),"\084\101\115\116 \050","\080\097\116\104 \114\101\116\117\114\110\101\100 \105\110\099\111\114\114\101\099\116\108\121\046")I:AssertEquals(z:GetResource("\084\101\115\116\050\046\070\111\108\100\101\114\051\065\046\077\111\100\117\108\101\083\099\114\105\112\116\051\065"),"\084\101\115\116 \052","\080\097\116\104 \114\101\116\117\114\110\101\100 \105\110\099\111\114\114\101\099\116\108\121\046")I:AssertEquals(z.ClassName,"\078\101\120\117\115\080\114\111\106\101\099\116\067\111\110\116\101\120\116","\067\111\110\116\101\120\116 \099\108\097\115\115 \105\115 \105\110\099\111\114\114\101\099\116\046")I:AssertEquals(y.__ExternalDependencies[script],{"\070\111\108\100\101\114\049\065\046\070\111\108\100\101\114\049\066\046\077\111\100\117\108\101\083\099\114\105\112\116\049\066","\084\101\115\116\050\046\070\111\108\100\101\114\051\065\046\077\111\100\117\108\101\083\099\114\105\112\116\051\065"},"\069\120\116\101\114\110\097\108 \100\101\112\101\110\100\101\110\099\105\101\115 \105\115 \105\110\099\111\114\114\101\099\116\046")end)I:RegisterUnitTest("\071\101\116\082\101\115\111\117\114\099\101",function(I)local y,n,b,G=g()I:AssertEquals(y:GetResource(""),n,"\080\097\116\104 \114\101\116\117\114\110\101\100 \105\110\099\111\114\114\101\099\116\108\121\046")I:AssertEquals(y:GetResource("\077\111\100\117\108\101\083\099\114\105\112\116\049\065"),"\084\101\115\116 \049","\080\097\116\104 \114\101\116\117\114\110\101\100 \105\110\099\111\114\114\101\099\116\108\121\046")I:AssertEquals(y:GetResource("\070\111\108\100\101\114\049\065"),n.Folder1A,"\080\097\116\104 \114\101\116\117\114\110\101\100 \105\110\099\111\114\114\101\099\116\108\121\046")I:AssertEquals(y:GetResource("\070\111\108\100\101\114\049\065\046\070\111\108\100\101\114\049\066"),n.Folder1A.Folder1B,"\080\097\116\104 \114\101\116\117\114\110\101\100 \105\110\099\111\114\114\101\099\116\108\121\046")I:AssertEquals(y:GetResource("\070\111\108\100\101\114\049\065\046\070\111\108\100\101\114\049\066\046\077\111\100\117\108\101\083\099\114\105\112\116\049\066"),"\084\101\115\116 \050","\080\097\116\104 \114\101\116\117\114\110\101\100 \105\110\099\111\114\114\101\099\116\108\121\046")I:AssertEquals(y:GetResource("\084\101\115\116\049"),b,"\080\097\116\104 \114\101\116\117\114\110\101\100 \105\110\099\111\114\114\101\099\116\108\121\046")I:AssertEquals(y:GetResource("\084\101\115\116\049\046\077\111\100\117\108\101\083\099\114\105\112\116\050\065"),"\084\101\115\116 \051","\080\097\116\104 \114\101\116\117\114\110\101\100 \105\110\099\111\114\114\101\099\116\108\121\046")I:AssertEquals(y:GetResource("\084\101\115\116\050"),G,"\080\097\116\104 \114\101\116\117\114\110\101\100 \105\110\099\111\114\114\101\099\116\108\121\046")I:AssertEquals(y:GetResource("\084\101\115\116\050\046\070\111\108\100\101\114\051\065"),G.Folder3A,"\080\097\116\104 \114\101\116\117\114\110\101\100 \105\110\099\111\114\114\101\099\116\108\121\046")I:AssertEquals(y:GetResource("\084\101\115\116\050\046\070\111\108\100\101\114\051\065\046\077\111\100\117\108\101\083\099\114\105\112\116\051\065"),"\084\101\115\116 \052","\080\097\116\104 \114\101\116\117\114\110\101\100 \105\110\099\111\114\114\101\099\116\108\121\046")end)I:RegisterUnitTest("\083\101\116\082\101\115\111\117\114\099\101",function(I)local y,n,b,G=g()y:SetResource("\077\111\100\117\108\101\083\099\114\105\112\116\049\065","\084\101\115\116 \053")y:SetResource("\084\101\115\116\051\046\082\101\115\111\117\114\099\101","\084\101\115\116 \054")I:AssertEquals(y:GetResource("\077\111\100\117\108\101\083\099\114\105\112\116\049\065"),"\084\101\115\116 \053","\082\101\115\111\117\114\099\101 \105\115 \105\110\099\111\114\114\101\099\116\046")I:AssertEquals(y:GetResource("\084\101\115\116\051\046\082\101\115\111\117\114\099\101"),"\084\101\115\116 \054","\082\101\115\111\117\114\099\101 \105\115 \105\110\099\111\114\114\101\099\116\046")end)return true
--[[
TheNexusAvenger

Tests the NexusProject class.
--]]

local NexusUnitTesting = require("NexusUnitTesting")

local NexusProject = require(game:GetService("ReplicatedStorage"):WaitForChild("NexusProject"))



--[[
Creates the component under testing and sub-instances.
--]]
local function Setup()
	--Create the folders and a ModuleScript.
	local Folder1 = Instance.new("Folder")
	Folder1.Name = "Folder1"
	
	local ModuleScript1A = Instance.new("ModuleScript")
	ModuleScript1A.Name = "ModuleScript1A"
	ModuleScript1A.Source = "return \"Test 1\""
	ModuleScript1A.Parent = Folder1
	
	local Folder1A = Instance.new("Folder")
	Folder1A.Name = "Folder1A"
	Folder1A.Parent = Folder1
	
	local Folder1B = Instance.new("Folder")
	Folder1B.Name = "Folder1B"
	Folder1B.Parent = Folder1A
	
	local ModuleScript1B = Instance.new("ModuleScript")
	ModuleScript1B.Name = "ModuleScript1B"
	ModuleScript1B.Source = "return \"Test 2\""
	ModuleScript1B.Parent = Folder1B
	
	local Folder2 = Instance.new("Folder")
	Folder2.Name = "Folder2"
	
	local ModuleScript2A = Instance.new("ModuleScript")
	ModuleScript2A.Name = "ModuleScript2A"
	ModuleScript2A.Source = "return \"Test 3\""
	ModuleScript2A.Parent = Folder2
	
	local Folder3 = Instance.new("Folder")
	Folder3.Name = "Folder3"
	
	local Folder3A = Instance.new("Folder")
	Folder3A.Name = "Folder3A"
	Folder3A.Parent = Folder3
	
	local ModuleScript3A = Instance.new("ModuleScript")
	ModuleScript3A.Name = "ModuleScript3A"
	ModuleScript3A.Source = "return \"Test 4\""
	ModuleScript3A.Parent = Folder3A
	
	local ModuleScript3B = Instance.new("ModuleScript")
	ModuleScript3B.Name = "ModuleScript3B"
	ModuleScript3B.Source = "wait(0.1) return \"Test 5\""
	ModuleScript3B.Parent = Folder3A
	
	--Create the component under testing.
	local CuT = NexusProject.new(Folder1)
	CuT:CreatePathLink("Test1",Folder2)
	CuT:CreatePathLink("Test2",Folder3)
	
	--Return the CuT and folders.
	return CuT,Folder1,Folder2,Folder3
end

--[[
Tests the IsLoading method.
--]]
NexusUnitTesting:RegisterUnitTest("IsLoading",function(UnitTest)
	--Create the component under testing.
	local CuT,Folder1,Folder2,Folder3 = Setup()
	
	--Load the resouce in a co-routine.
	coroutine.wrap(function()
		CuT:GetResource("Test2.Folder3A.ModuleScript3B")
	end)()
	
	--Run the assertions.
	wait()
	UnitTest:AssertTrue(CuT:IsLoading("Test2.Folder3A.ModuleScript3B"),"Resource is loaded.")
	wait(0.1)
	UnitTest:AssertFalse(CuT:IsLoading("Test2.Folder3A.ModuleScript3B"),"Resource is not loaded.")
	UnitTest:AssertEquals(CuT:GetResource("Test2.Folder3A.ModuleScript3B"),"Test 5","Resource is incorrect.")
end)

--[[
Tests the IsInstanceInPath method.
--]]
NexusUnitTesting:RegisterUnitTest("IsInstanceInPath",function(UnitTest)
	--Create the component under testing.
	local CuT,Folder1,Folder2,Folder3 = Setup()
	
	--Run the assertions for valid instances.
	UnitTest:AssertTrue(CuT:IsInstanceInPath(Folder1))
	UnitTest:AssertTrue(CuT:IsInstanceInPath(Folder1.ModuleScript1A))
	UnitTest:AssertTrue(CuT:IsInstanceInPath(Folder1.Folder1A))
	UnitTest:AssertTrue(CuT:IsInstanceInPath(Folder1.Folder1A.Folder1B))
	UnitTest:AssertTrue(CuT:IsInstanceInPath(Folder1.Folder1A.Folder1B.ModuleScript1B))
	UnitTest:AssertTrue(CuT:IsInstanceInPath(Folder2))
	UnitTest:AssertTrue(CuT:IsInstanceInPath(Folder2.ModuleScript2A))
	UnitTest:AssertTrue(CuT:IsInstanceInPath(Folder3))
	UnitTest:AssertTrue(CuT:IsInstanceInPath(Folder3.Folder3A))
	UnitTest:AssertTrue(CuT:IsInstanceInPath(Folder3.Folder3A.ModuleScript3A))
	UnitTest:AssertFalse(CuT:IsInstanceInPath(game:GetService("Workspace")))
end)

--[[
Tests the IsResourceCyclic method.
--]]
NexusUnitTesting:RegisterUnitTest("IsResourceCyclic",function(UnitTest)
	--Create the component under testing.
	local CuT = NexusProject.new(script)
	CuT:__AddInternalDependency("Test1","Test2")
	CuT:__AddInternalDependency("Test1","Test3")
	CuT:__AddInternalDependency("Test2","Test4")
	CuT:__AddInternalDependency("Test3","Test2")
	CuT:__AddInternalDependency("Test4","Test5")
	CuT:__AddInternalDependency("Test5","Test1")
	CuT:__AddInternalDependency("Test5","Test6")
	
	--Run the assertions.
	UnitTest:AssertTrue(CuT:IsResourceCyclic("Test1"),"Test1 isn't cyclic.")
	UnitTest:AssertTrue(CuT:IsResourceCyclic("Test2"),"Test2 isn't cyclic.")
	UnitTest:AssertTrue(CuT:IsResourceCyclic("Test3"),"Test3 isn't cyclic.")
	UnitTest:AssertTrue(CuT:IsResourceCyclic("Test4"),"Test4 isn't cyclic.")
	UnitTest:AssertTrue(CuT:IsResourceCyclic("Test5"),"Test5 isn't cyclic.")
	UnitTest:AssertFalse(CuT:IsResourceCyclic("Test6"),"Test6 is cyclic.")
	UnitTest:AssertFalse(CuT:IsResourceCyclic("Test7"),"Test7 is cyclic.")
end)

--[[
Tests the GetPathFromInstance method.
--]]
NexusUnitTesting:RegisterUnitTest("GetPathFromInstance",function(UnitTest)
	--Create the component under testing.
	local CuT,Folder1,Folder2,Folder3 = Setup()
	
	--Run the assertions for valid paths.
	UnitTest:AssertEquals(CuT:GetPathFromInstance(Folder1),"")
	UnitTest:AssertEquals(CuT:GetPathFromInstance(Folder1.ModuleScript1A),"ModuleScript1A")
	UnitTest:AssertEquals(CuT:GetPathFromInstance(Folder1.Folder1A),"Folder1A")
	UnitTest:AssertEquals(CuT:GetPathFromInstance(Folder1.Folder1A.Folder1B),"Folder1A.Folder1B")
	UnitTest:AssertEquals(CuT:GetPathFromInstance(Folder1.Folder1A.Folder1B.ModuleScript1B),"Folder1A.Folder1B.ModuleScript1B")
	UnitTest:AssertEquals(CuT:GetPathFromInstance(Folder2),"Test1")
	UnitTest:AssertEquals(CuT:GetPathFromInstance(Folder2.ModuleScript2A),"Test1.ModuleScript2A")
	UnitTest:AssertEquals(CuT:GetPathFromInstance(Folder3),"Test2")
	UnitTest:AssertEquals(CuT:GetPathFromInstance(Folder3.Folder3A),"Test2.Folder3A")
	UnitTest:AssertEquals(CuT:GetPathFromInstance(Folder3.Folder3A.ModuleScript3A),"Test2.Folder3A.ModuleScript3A")
	
	--Assert non-project paths error.
	UnitTest:AssertErrors(function()
		CuT:GetPathFromInstance(game:GetService("Workspace"))
	end)
end)

--[[
Tests the GetDependencyPath method.
--]]
NexusUnitTesting:RegisterUnitTest("GetDependencyPath",function(UnitTest)
	--Create the component under testing.
	local CuT = NexusProject.new(script)
	CuT:__AddInternalDependency("Test1","Test2")
	CuT:__AddInternalDependency("Test1","Test3")
	CuT:__AddInternalDependency("Test2","Test4")
	CuT:__AddInternalDependency("Test3","Test2")
	CuT:__AddInternalDependency("Test4","Test5")
	CuT:__AddInternalDependency("Test5","Test1")
	CuT:__AddInternalDependency("Test5","Test6")
	
	--Run the assertions.
	UnitTest:AssertEquals(CuT:GetDependencyPath("Test1","Test3"),{"Test1","Test3"},"Path is incorrect.")
	UnitTest:AssertEquals(CuT:GetDependencyPath("Test1","Test1"),{"Test1","Test2","Test4","Test5","Test1"},"Path is incorrect.")
	UnitTest:AssertEquals(CuT:GetDependencyPath("Test2","Test2"),{"Test2","Test4","Test5","Test1","Test2"},"Path is incorrect.")
	UnitTest:AssertEquals(CuT:GetDependencyPath("Test3","Test3"),{"Test3","Test2","Test4","Test5","Test1","Test3"},"Path is incorrect.")
	UnitTest:AssertEquals(CuT:GetDependencyPath("Test4","Test4"),{"Test4","Test5","Test1","Test2","Test4"},"Path is incorrect.")
	UnitTest:AssertEquals(CuT:GetDependencyPath("Test5","Test5"),{"Test5","Test1","Test2","Test4","Test5"},"Path is incorrect.")
	UnitTest:AssertNil(CuT:GetDependencyPath("Test1","Test7"),"Path exists.")
	UnitTest:AssertNil(CuT:GetDependencyPath("Test6","Test6"),"Path exists.")
	UnitTest:AssertNil(CuT:GetDependencyPath("Test7","Test7"),"Path exists.")
end)

--[[
Tests the GetContext method.
--]]
NexusUnitTesting:RegisterUnitTest("GetContext",function(UnitTest)
	--Create the component under testing.
	local CuT,Folder1,Folder2,Folder3 = Setup()
	
	--Create the context and get some resources.
	local Context = CuT:GetContext(script)
	UnitTest:AssertEquals(Context:GetResource("Folder1A.Folder1B.ModuleScript1B"),"Test 2","Path returned incorrectly.")
	UnitTest:AssertEquals(Context:GetResource("Test2.Folder3A.ModuleScript3A"),"Test 4","Path returned incorrectly.")
	
	--Run the assertions.
	UnitTest:AssertEquals(Context.ClassName,"NexusProjectContext","Context class is incorrect.")
	UnitTest:AssertEquals(CuT.__ExternalDependencies[script],{"Folder1A.Folder1B.ModuleScript1B","Test2.Folder3A.ModuleScript3A"},"External dependencies is incorrect.")
end)

--[[
Tests the GetResource method.
--]]
NexusUnitTesting:RegisterUnitTest("GetResource",function(UnitTest)
	--Create the component under testing.
	local CuT,Folder1,Folder2,Folder3 = Setup()
	
	--Run the assertions.
	UnitTest:AssertEquals(CuT:GetResource(""),Folder1,"Path returned incorrectly.")
	UnitTest:AssertEquals(CuT:GetResource("ModuleScript1A"),"Test 1","Path returned incorrectly.")
	UnitTest:AssertEquals(CuT:GetResource("Folder1A"),Folder1.Folder1A,"Path returned incorrectly.")
	UnitTest:AssertEquals(CuT:GetResource("Folder1A.Folder1B"),Folder1.Folder1A.Folder1B,"Path returned incorrectly.")
	UnitTest:AssertEquals(CuT:GetResource("Folder1A.Folder1B.ModuleScript1B"),"Test 2","Path returned incorrectly.")
	UnitTest:AssertEquals(CuT:GetResource("Test1"),Folder2,"Path returned incorrectly.")
	UnitTest:AssertEquals(CuT:GetResource("Test1.ModuleScript2A"),"Test 3","Path returned incorrectly.")
	UnitTest:AssertEquals(CuT:GetResource("Test2"),Folder3,"Path returned incorrectly.")
	UnitTest:AssertEquals(CuT:GetResource("Test2.Folder3A"),Folder3.Folder3A,"Path returned incorrectly.")
	UnitTest:AssertEquals(CuT:GetResource("Test2.Folder3A.ModuleScript3A"),"Test 4","Path returned incorrectly.")
end)

--[[
Tests the SetResource method.
--]]
NexusUnitTesting:RegisterUnitTest("SetResource",function(UnitTest)
	--Create the component under testing.
	local CuT,Folder1,Folder2,Folder3 = Setup()
	
	--Set up the resources.
	CuT:SetResource("ModuleScript1A","Test 5")
	CuT:SetResource("Test3.Resource","Test 6")
	
	--Run the assertions.
	UnitTest:AssertEquals(CuT:GetResource("ModuleScript1A"),"Test 5","Resource is incorrect.")
	UnitTest:AssertEquals(CuT:GetResource("Test3.Resource"),"Test 6","Resource is incorrect.")
end)



return true