static void Main(String[] args) { if (args.Length > 0) { MessageBox.Show("" + args[0]); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainForm MainForm = new MainForm(); User user = new User("Mattias"); Presenter presenter = new Presenter(MainForm, user); Application.Run(MainForm); }
public void TestPresenterConstructor() { MockView View = new MockView(); User user = new User("testUser"); Presenter pres = new Presenter(View, user); // Constructor Assert.AreEqual(pres, View.p); // stopAndHideTimer Assert.AreEqual(true, View.timerHidden); // updateMoodButtons Assert.AreEqual("VerySad", View.one); Assert.AreEqual("Sad", View.two); Assert.AreEqual("Happy", View.three); Assert.AreEqual("VeryHappy", View.four); Assert.AreEqual("How do you feel?", View.title); // showAllMoodButtons Assert.AreEqual(true, View.showAllMoodButtonsFlag); }
public void TestMoodButtonPressed() { MockView View = new MockView(); User user = new User("testUser"); Presenter pres = new Presenter(View, user); pres.moodButtonPressed("Sad"); Assert.AreEqual("VeryTierd", View.one); Assert.AreEqual("Tired", View.two); Assert.AreEqual("Energetic", View.three); Assert.AreEqual("VeryEnergetic", View.four); Assert.AreEqual("How do you feel?", View.title); pres.moodButtonPressed("Tired"); Assert.AreEqual("VeryStressed", View.one); Assert.AreEqual("Stressed", View.two); Assert.AreEqual("Calm", View.three); Assert.AreEqual("VeryCalm", View.four); Assert.AreEqual("How do you feel?", View.title); pres.moodButtonPressed("Stressed"); Assert.AreEqual("VeryLonely", View.one); Assert.AreEqual("Lonely", View.two); Assert.AreEqual("Sociable", View.three); Assert.AreEqual("VerySociable", View.four); Assert.AreEqual("How do you feel?", View.title); pres.moodButtonPressed("Lonely"); Assert.AreEqual("Update now!", View.one); Assert.AreEqual("Hidden", View.two); Assert.AreEqual("Hidden", View.three); Assert.AreEqual("Hidden", View.four); Assert.AreEqual("Do you want to update your Mood?", View.title); Assert.AreEqual(false, View.showAllMoodButtonsFlag); Assert.IsNotNull(View.ActivityList); }
/// <summary> /// Sets the presenter for this form /// </summary> /// <param name="presenter"></param> the presenter for this form public void setPresenter(Presenter presenter) { this.presenter = presenter; }
public void TestActivityPressed() { MockView View = new MockView(); User user = new User("testUser"); Presenter pres = new Presenter(View, user); pres.activityPressed("Limbo"); Assert.AreEqual("How low can you go?", View.testActivityDescription); }
public void setPresenter(Presenter presenter) { p = presenter; }
public void TestChangeBetweenChallengeAndActivity() { MockView View = new MockView(); User user = new User("testUser"); Presenter pres = new Presenter(View, user); // In the current form changeBetweenChallengeAndActivity takes gui elements. This should not be the case. // It should instead take strings and communicate back via the interface IActivityMain by calling methods // and passing arguments as strings. Once this is done }
public void TestActivityGradeButtonPressed() { MockView View = new MockView(); User user = new User("testUser"); Presenter pres = new Presenter(View, user); pres.activityGradeButtonPressed(2, "THIS WAS AUTO-GENERATED FROM A TEST, REMOVE FROM THE DATABASE"); }
public void TestTimer() { MockView View = new MockView(); User user = new User("testUser"); Presenter pres = new Presenter(View, user); // The following is a stub... /* XXX MUST BE REPLACED BY AN ACTIVITY USING THE TIMER! pres.startButtonPressed(XXX); int timeLeft = user.CurrentActivity.TimeLeft; for (int i = 0; i < timeLeft; i++) { pres.timerTick(); Assert.AreEqual(String.Format("{0:00} min {1:00} sec", timeLeft / 60, timeLeft % 60), View.testTimeLeft); } pres.timerTick(); Assert.AreEqual(true, View.testcreateActivityPopUp); */ }
public void TestStartButtonPressed() { MockView View = new MockView(); User user = new User("testUser"); Presenter pres = new Presenter(View, user); // The following is a stub... // The activity test is covered by TestTimer // For challange: // Once adapted to the MVP pattern [labelDescription.Text = "Description"] and [l.Text = "Activities for challenge"] should be set // using a method (in IActivityMain) that takes 2 string params. These needs to be verified using the MockView... }
public void TestChallengePressed() { MockView View = new MockView(); User user = new User("testUser"); Presenter pres = new Presenter(View, user); pres.challengePressed("Flexibility & Strength"); Assert.AreEqual("Complete both Strength of an ox and Limbo Master to finish this challenge!", View.testChallangeDescription); }