public void H_FindFavouriteStory_FindsTheFavouriteStory_ReturnsStoryWithId1() { _db.CreateConnection(); int expected = 1; var actual = _db.FindFavouriteStory().Id; Assert.AreEqual(expected, actual, "FindFavouriteStory_ReturnsStoryWithId1_ReturnsStoryWithId1: Did not return story with Id 1"); }
/* * Method name: OnCreate * Purpose: To set up the story page depending whether the user has selected the favourite or todays story button */ protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.StoryView); _storyId = Intent.GetStringExtra("Story"); _storyIndex = Intent.GetStringExtra("StoryIndex"); ImageView pictureButton = FindViewById <ImageView>(Resource.Id.pictureBox); _db = new Database.Database(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "ShareMyDay.db3"); var options = new BitmapFactory.Options { InJustDecodeBounds = true }; var sample = 4; options.InSampleSize = sample; options.InJustDecodeBounds = false; Database.Models.Story story; if (_storyId == "Favourite") { story = _db.FindFavouriteStory(); if (story != null) { SetupStory(story, options, pictureButton, _db, true); } else { Intent noFavouriteStories = new Intent(this, typeof(NoStoriesActivity)); noFavouriteStories.PutExtra("StoryType", "Favourite"); StartActivity(noFavouriteStories); } } else { story = _db.FindStoryById(_storyId); SetupStory(story, options, pictureButton, _db, false); } }