public void StoryModel_Set_Active_Story_Test() { //Fetch stories and get the first one from the list Story initialStory = GetStories()[0]; Story newStory = GetStories()[1]; //Create a new StoryModel new StoryModel(initialStory); //Test that the Instance gets initialized properly StoryModel storyModel = StoryModel.GetInstance(); //Change active story in Model storyModel.SetActiveStory(newStory); //Fetch a list of locations from the model List <Location> modelLocations = storyModel.GetStoryLocations(); //Iterate through the locations fetched from Model int i = 0; foreach (var location in modelLocations) { //Check that all locations match Assert.AreSame(newStory.locations[i], modelLocations[i]); i++; } }
/// <summary> /// Defauly constructor /// </summary> /// <param name="taskView">Reference of the view for this class</param> public TaskPresenter(TaskView taskView) { _taskView = taskView; //Fetch the model instances _locationModel = LocationModel.GetInstance(); _storyModel = StoryModel.GetInstance(); //Get the active story _activeStory = _storyModel.GetActiveStory(); //Get the active task _task = _locationModel.GetLocationTask(); //Apply image content depending on of the task has an image or not if (_task.taskviewSprite != null) { _taskView.SetTaskContent(_task.GetLocalizedTitle(), _task.taskviewSprite, _task.GetLocalizedText()); } else { _taskView.SetTaskContent(_task.GetLocalizedTitle(), _task.GetLocalizedText()); } //Display the AR scanner button if the task has AR content _taskView.SetARScannerBtnActive(_task.isARTask); }
/// <summary> /// Constructor for <see cref="LocationlistPresenter"/> /// </summary> /// <param name="locationlistView">Reference to the <see cref="LocationlistView"/></param> public LocationlistPresenter(LocationlistView locationlistView) { _locationlistView = locationlistView; //Fetch the StoryModel instance _storyModel = StoryModel.GetInstance(); //Fetch a reference to the currenctly active Story _story = _storyModel.GetActiveStory(); //Set the view content _locationlistView.SetViewTitle(_story.GetLocalizedTitle()); _locationlistView.SetLocationsImage(_story.locationMapSprite); PopulateLocationList(_story); }