annotate Tests.lua @ 18:a3328fffef5c

Split of main file into components
author wobin
date Thu, 07 May 2009 02:52:23 +1000
parents 2231fd3f139b
children
rev   line source
wobin@3 1 -- Tests for Squawk
wobin@3 2
wobin@3 3 if not Squawk then return end
wobin@3 4
wobin@3 5 --[[
wobin@3 6 --Tests we need to do:
wobin@3 7 --
wobin@4 8 -- Add a follower
wobin@4 9 -- Remove a follower
wobin@4 10 -- Request to follow someone
wobin@4 11 -- Recieve a request from a follower
wobin@4 12 -- Send a Squawk
wobin@4 13 -- Recieve a direct Squawk
wobin@4 14 -- Send a Squawk to the Guild
wobin@4 15 -- Recieve a Squawk from the Guild
wobin@3 16 --]]
wobin@4 17 --
wobin@4 18
wobin@10 19 SquawkTester = LibStub("AceAddon-3.0"):NewAddon("SquawkTester", "AceComm-3.0", "AceConsole-3.0")
wobin@4 20
wobin@4 21 local Test = SquawkTester
wobin@10 22 local Controller = Squawk.Controller
wobin@10 23 local Settings = Squawk.Model.UserSettings
wobin@4 24
wobin@4 25 function Test:OnInitialize()
wobin@10 26 self:RegisterComm("Squawk", "ReceiveMessage")
wobin@10 27 self:RegisterChatCommand("TS", "RunTests")
wobin@10 28 self:Print("Initialising Tester")
wobin@10 29
wobin@10 30 self.Tests = { ["a"] = SquawkTester.AddPublicFollower,
wobin@10 31 ["b"] = SquawkTester.RemovePublicFollower,
wobin@10 32 ["c"] = SquawkTester.AddPrivateFollower,
wobin@10 33 ["d"] = SquawkTester.ApprovePendingRequest
wobin@10 34 }
wobin@4 35 end
wobin@10 36 function Test:RunTests(TestNumber)
wobin@10 37 self:Print(TestNumber)
wobin@10 38 self.Tests[TestNumber](Test)
wobin@4 39 end
wobin@4 40
wobin@7 41 function Test:AddPublicFollower()
wobin@10 42 Settings:TogglePrivate()
wobin@10 43 Controller:IWantToFollowThem(UnitName("player"))
wobin@7 44 end
wobin@7 45
wobin@7 46 function Test:RemovePublicFollower()
wobin@10 47 Controller:IWantToUnfollowThem(UnitName("player"))
wobin@7 48 end
wobin@7 49
wobin@7 50 function Test:AddPrivateFollower()
wobin@10 51 Settings:TogglePrivate()
wobin@10 52 Controller:IWantToFollowThem(UnitName("player"))
wobin@7 53 end
wobin@7 54
wobin@7 55 function Test:ApprovePendingRequest()
wobin@10 56 Controller:ApprovePendingRequest(UnitName("player"))
wobin@4 57 end
wobin@4 58
wobin@4 59 function Test:ReceiveMessage(Prefix, Message, Distribution, Sender)
wobin@4 60 end
wobin@4 61
wobin@4 62 function Test:SendMessageDirectly(Message)
wobin@4 63
wobin@4 64 end