// Create new StreamingContent private void CreateNewContent() { Console.Clear(); StreamingContent newContent = new StreamingContent(); //Title Console.WriteLine("Enter the Title for the content"); newContent.Title = Console.ReadLine(); //Description Console.WriteLine("Enter the description for the content:"); newContent.Description = Console.ReadLine(); //Maturity Rating Console.WriteLine("Enter the rating for the content (G, PG, PG-13, ect):"); newContent.MaturityRating = Console.ReadLine(); //Star Rating Console.WriteLine("Enter the star count for the content (5.8, a0, 1.5, ect):"); string starAsString = Console.ReadLine(); newContent.StarRating = double.Parse(starAsString); //IsFamilyFriendly Console.WriteLine("Is this Content famliy friendly?"); string familyFriendlyString = Console.ReadLine().ToLower(); if(familyFriendlyString == "y") { newContent.IsFamilyFriendly = true; } else { newContent.IsFamilyFriendly = false; } //GenreType Console.WriteLine("Enter the Genre Number:\n" + "1. Horror\n" + "2. ROmCom\n" + "3. Scfi\n" + "4. Documentary\n" + "5. Bromance\n" + "6. Drama\n" + "7. Action"); string genreAsString = Console.ReadLine(); int genreAsInt = int.Parse(genreAsString); newContent.TypeOfGenre = (GenreType)genreAsInt; _contentRepo.AddContentToList(newContent); }
public void StreamingContentRepository_AddContentToList_ShouldReturnCorrectCount() { //Arrange List <StreamingContent> contentList = _contentRepoTest.GetContentList(); StreamingContent content = new StreamingContent(); //Act _contentRepoTest.AddContentToList(content); var actual = contentList.Count; var expected = 1; //Assert Assert.AreEqual(expected, actual); }
private void CreateAndAddContentToList() { // Initialize a new streaming content object StreamingContent content = new StreamingContent(); // Get Title Console.Write("Please enter a title: "); content.Title = Console.ReadLine(); // Get Description Console.Write("Please enter a description: "); content.Description = Console.ReadLine(); // Get RunTime in minutes Console.Write("Please enter a run time in minutes: "); string runTime = Console.ReadLine(); content.RunTimeInMinutes = double.Parse(runTime); // Get Star Rating Console.Write("Please enter the star rating (1-5): "); content.StarRating = double.Parse(Console.ReadLine()); // Get Maturity Rating Console.Write("Please enter the maturity rating (G, PG, etc.): "); content.MaturityRating = Console.ReadLine(); // Get IsFamilyFriendly Console.Write("This is family friendly (true/false): "); content.IsFamilyFriendly = bool.Parse(Console.ReadLine()); // Get GenreType Console.WriteLine("What is the genre?\n" + "1. Noir\n" + "2. Horror\n" + "3. RomCom\n" + "4. SciFi\n" + "5. WildWest\n" + "6. Documentary\n" + "7. Bromance\n" + "8. Drama\n" + "9. Action"); int genreNumber = int.Parse(Console.ReadLine()); content.TypeOfGenre = (GenreType)genreNumber; // Add streaming content to repository list _streamingRepo.AddContentToList(content); }
//create new streaming content private void CreateNewContent() { StreamingContent newContent = new StreamingContent(); //Title Console.WriteLine("Enter the Title for the content:"); newContent.Title = Console.ReadLine(); //Description Console.WriteLine("Enter the Description for the content: "); newContent.Description = Console.ReadLine(); //MaturityRating Console.WriteLine("Enter the rating for the content (G, PG, PG-13, R): "); newContent.MaturityRating = Console.ReadLine(); //StarRating Console.WriteLine("Enter the Star Count for the content:"); string starsAsString = Console.ReadLine(); newContent.StarRating = double.Parse(starsAsString); //ISFamilyFriendly Console.WriteLine("Is this family friendly content?"); string familyFriendlyString = Console.ReadLine().ToLower(); if(familyFriendlyString == "y") { newContent.IsFamilyFriendly = true; } else { newContent.IsFamilyFriendly = false; } //GenreType Console.WriteLine("Enter the Genre NUmber: \n" + "1. Horror\n" + "2. RomCom\n" + "3. SciFi\n" + "4. Documentary\n" + "5. Romance\n" + "6. Drama\n" + "7. Action\n"); string genreAsString = Console.ReadLine(); int genreAsInt = int.Parse(genreAsString); newContent.TypeOfGenre = (GenereType)genreAsInt; _contentRepo.AddContentToList(newContent); }
//Create new Streaming Content private void CreateNewContent() { Console.Clear(); //Clears the menu off the string StreamingContent newContent = new StreamingContent(); //Title Console.WriteLine("Enter the title for the content:"); newContent.Title = Console.ReadLine(); //Description Console.WriteLine("Enter the description for the content:"); newContent.Description = Console.ReadLine(); //Maturity Rating Console.WriteLine("Enter the rating for the content (G, PG, PG-13, etc):"); newContent.MaturityRating = Console.ReadLine(); //Star Rating Console.WriteLine("Enter the star count for the content:"); string starsAsString = Console.ReadLine(); newContent.StarRating = double.Parse(starsAsString); //IsFamilyFriendly Console.WriteLine("Is this content family friendly? (Y/N)"); string familyFriendlyString = Console.ReadLine().ToLower(); if (familyFriendlyString == "y") { newContent.IsFamilyFriendly = true; } else { newContent.IsFamilyFriendly = false; } //GenreType Console.WriteLine("Enter the Genre Number:\n" + "1. Horror\n" + "2. RomCom\n" + "3. SciFi\n" + "4. Documentary\n" + "5. Bromance\n" + "6. Drama\n" + "7. Action"); string genreAsString = Console.ReadLine(); int genreAsInt = int.Parse(genreAsString); //turns the string into an integer newContent.TypeOfGenre = (GenreType)genreAsInt; //turns the integer untl Genre type (casting) _contentRepo.AddContentToList(newContent); }
public void StreamingContentUpdateTest() { // Arrange -- TestInitialize // Act _contentRepo.AddContentToList(_content); StreamingContent newContent = new StreamingContent("Toy Story 2", GenreType.Bromance, "You've got a friend in me.", 120.5d, 10d, "G", true); _contentRepo.UpdateExistingContent("Toy Story", newContent); StreamingContent updatedContent = _contentRepo.GetContentByTitle("Toy Story 2"); // Assert Assert.AreEqual(updatedContent.Description, newContent.Description); }
public void Arrange() { _repo = new StreamingContentRepository(); _content = new StreamingContent("Happy Gilmore", "Funny Golf Movie", "PG-13", 10, true, GenreType.Comedy); _repo.AddContentToList(_content); }
public void Arrange() { _repo = new StreamingContentRepository(); _content = new StreamingContent("Rubber", "A car tire comes to life with the power to make people explode and goes on a murderous rampage through the Californian desert.", "R", 5.8, false, GenreType.Drama); _repo.AddContentToList(_content); }
public void StreamingContentRepositoryAddToList() { StreamingContentRepository contentRepo = new StreamingContentRepository(); StreamingContent content = new StreamingContent("Toy story", GenreType.Bromance, "Good", 120d, 8d, "PG13", true); contentRepo.AddContentToList(content); int expected = 1; int actual = contentRepo.GetStreamingContentList().Count; Assert.AreEqual(expected, actual); contentRepo.GetContentByTitle("Toy story"); string expectedTitle = "Toy story"; Assert.AreEqual(content, contentRepo.GetContentByTitle(expectedTitle)); int expectedRemoveCount = 0; contentRepo.RemoveContentFromList(content); int actualRemoveCount = contentRepo.GetStreamingContentList().Count; Assert.AreEqual(expectedRemoveCount, actualRemoveCount); }
public void Arrange() { _repo = new StreamingContentRepository(); _content = new StreamingContent("Rubber", "Car tire comes to life and goes on a killing spree.", "R", 5.8, false, GenreType.Documentary); _repo.AddContentToList(_content); }
public void Arrange() { _repo = new StreamingContentRepository(); _content = new StreamingContent("Revenge of the Sith", "You were a brother to me!", "PG-13", 9.9, true, GenreType.Documentary); _repo.AddContentToList(_content); }
public void StreamingContentRepository_AddToList_ShouldReturnCorrectCount() { //Arrange StreamingContent music = new StreamingContent(); StreamingContent movie = new StreamingContent(); StreamingContentRepository repo = new StreamingContentRepository(); //Act repo.AddContentToList(music); repo.AddContentToList(movie); int actual = repo.GetStreamingContentList().Count; int expected = 2; //Assert Assert.AreEqual(expected, actual); }
public void StreamingContentRepository_AddToList_ShouldReturnCorrectCount() { //Arrange StreamingContent content = new StreamingContent("hello", "horror", 1.3f, false, 5); StreamingContent contentTwo = new StreamingContent(); StreamingContentRepository repo = new StreamingContentRepository(); //Act repo.AddContentToList(content); repo.AddContentToList(contentTwo); int actual = repo.GetStreamingContentList().Count; int expected = 2; //Assert Assert.AreEqual(expected, actual); }
[TestInitialize] // This says that everything right after this must run first public void Arrange() { _repo = new StreamingContentRepository(); // streaming repository field that has content _content = new StreamingContent("Rubber", "A car tyre comes to life with teh power to make people explode and goes on a " + "murderous rampage through the Californian desert", "R", 5.8, false, GenreType.Drama); // added some content _repo.AddContentToList(_content); // }
private void CreateContent() { StreamingContent content = new StreamingContent(); Console.WriteLine("\nCreating new content"); Console.WriteLine("Please enter a title: "); content.Title = Console.ReadLine(); Console.WriteLine("Enter content description: "); content.Description = Console.ReadLine(); Console.WriteLine("Enter content run time in minutes: "); content.RunTimeInMinutes = double.Parse(Console.ReadLine()); //convert Console.WriteLine("Enter Content Star rating (1-10)"); content.StarRating = double.Parse(Console.ReadLine()); Console.WriteLine("Enter Maturity rating (G, PG, etc): "); content.MaturityRating = Console.ReadLine(); Console.WriteLine("Is the content Family Friendly? (True/False)"); content.IsFamilyFriendly = bool.Parse(Console.ReadLine()); Console.WriteLine("Please choose a genre." + "1. Action\n" + "2. Bromance\n" + "3. Documentary\n" + "4. Drama\n" + "5. Horror\n" + "6. Noir\n" + "7. RomCom\n" + "8. SciFi\n" + "9. WildWest"); int genreNumber = int.Parse(Console.ReadLine()); content.TypeOfGenre = (GenreType)genreNumber; //called casting _streamingRepo.AddContentToList(content); Console.WriteLine($"Added content to List:\n" + $"\n{content.Title} - {content.Description}\n" + $"{content.StarRating} Stars\n" + $"Run time: {content.RunTimeInMinutes} minutes\n" + $"Maturity rating: {content.MaturityRating}\n" + $"Family Friendly: {content.IsFamilyFriendly}\n" + $"Genre: {content.TypeOfGenre}"); Console.WriteLine("\nPress any key to continue..."); Console.ReadKey(); }
public void StreamingContentRepository_RemoveFromList_ShouldReturnCorrectCount() { // Arrange StreamingContentRepository _contentRepo = new StreamingContentRepository(); List <StreamingContent> contentList = _contentRepo.GetContentList(); //Two instances of the StreamingContent class, our POCO (Plain Old CSharp Object) StreamingContent content = new StreamingContent(); StreamingContent contentTwo = new StreamingContent(); _contentRepo.AddContentToList(content); _contentRepo.AddContentToList(contentTwo); _contentRepo.RemoveContentFromList(content); // Act int actual = contentList.Count; int expected = 1; // Assert Assert.AreEqual(expected, actual); }
public void GetContentByTitleTest() { //Arrange StreamingContentRepository contentRepo = new StreamingContentRepository(); StreamingContent content = new StreamingContent("Toy Story", GenreType.Bromance, "Two enemies becomes friends.", 120d, 10d, "G", true); //Act contentRepo.AddContentToList(content); StreamingContent actual = contentRepo.GetContentByTitle("Toy Story"); //Assert Assert.AreEqual(content, actual); }
public void RemoveFromListTest() { // Arrange StreamingContentRepository contentRepo = new StreamingContentRepository(); StreamingContent content = new StreamingContent("Toy Story", GenreType.Bromance, "Two enemies becomes friends.", 120d, 10d, "G", true); // Act contentRepo.AddContentToList(content); bool wasRemoved = contentRepo.RemoveContentFromList(content); // Assert Assert.IsTrue(wasRemoved); }
public void AddToList_ShouldGetNotNull() { //Arrange --> Setting up the Playing Field StreamingContent content = new StreamingContent(); StreamingContentRepository repository = new StreamingContentRepository(); //Act --> Get/run the code we want to test repository.AddContentToList(content); StreamingContent contentFromDirectory = repository.GetContentByTitle("Toy Story"); //Assert --> Use the assert class to verify the expected outcome. Assert.IsNotNull(contentFromDirectory); }
public void AddToList_ShouldGetNotNull() { // Arrange = Setting up the playing field. StreamingContent content = new StreamingContent(); content.Title = "Friday"; StreamingContentRepository repository = new StreamingContentRepository(); // Act = Get/run the code we want to test. repository.AddContentToList(content); StreamingContent contentFromDirectory = repository.GetContentByTitle("Friday"); // Assert = Use the Assert class to verify the expected outcome. Assert.IsNotNull(contentFromDirectory); }
public void AddToList_ShouldGetNotNull() { //Arrange StreamingContent content = new StreamingContent(); content.Title = "Toy Story"; StreamingContentRepository repo = new StreamingContentRepository(); //Act repo.AddContentToList(content); StreamingContent contentFromDirectory = repo.GetContentByTitle("Toy Story"); //Assert Assert.IsNotNull(contentFromDirectory); }
public void StreamingContentRepository_EnqueueFromList_BoolShouldReturnTrue() { // Arrange StreamingContentRepository _contentRepo = new StreamingContentRepository(); StreamingContent content = new StreamingContent(); content.ContentTitle = "Star Wars"; content.Genre = Genre.Action; StreamingContent contentTwo = new StreamingContent(); contentTwo.ContentTitle = "Spider-Man"; contentTwo.Genre = Genre.Action; _contentRepo.AddContentToList(content); _contentRepo.AddContentToList(contentTwo); // Act var actual = _contentRepo.EnqueueFromList("Spider-Man", Genre.Action); var expected = true; // Assert Assert.AreEqual(expected, actual); }
public void StreamingContentRepository_AddContentToList_ShouldReturnCorrectCount() { //--Arrange StreamingContentRepository contentRepo = new StreamingContentRepository(); var list = contentRepo.GetContentList(); StreamingContent content = new StreamingContent(); //--Act contentRepo.AddContentToList(content); var actual = list.Count; var expected = 1; //--Assert Assert.AreEqual(expected, actual); }
public void SCRepository_AddToList_GetShouldReturnCorrectCount() { // Arrange -- Set up the playing field StreamingContent content = new StreamingContent(); StreamingContentRepository repo = new StreamingContentRepository(); repo.AddContentToList(content); // Act -- Get/run the code we want to test List <StreamingContent> actualList = repo.GetContentList(); int expected = 1; int actual = actualList.Count; //Assert -- Use the Assert class to verify the expected outcome Assert.AreEqual(expected, actual); }
public void AddToList_ShouldGetNotNull() { // Arrange --> Setting up the playing field // Adding a new StreamingContent object StreamingContent content = new StreamingContent(); // setting a value for one of the new StreamingContent object's properties content.Title = "Toy Story"; // Adding a new StreamingContentRepository object StreamingContentRepository repository = new StreamingContentRepository(); // Act --> Get/run the code we want to test // Adding the title property value of the new content object to the repository object repository.AddContentToList(content); /* Assigning contentFromDirectory object value to the string value of "Toy Story" * through the GetContentByTitle method of the repository object. */ StreamingContent contentFromDirectory = repository.GetContentByTitle("Toy Story"); // Assert --> Use the assert class to verify the expected outcome // contentFromDirectory should have a value if the AddContentToList method worked Assert.IsNotNull(contentFromDirectory); }
private void CreateNewContent() { Console.Clear(); StreamingContent newContent = new StreamingContent(); //title Console.WriteLine("Enter the title for the content:"); newContent.Title = Console.ReadLine(); //description Console.WriteLine("Enter the decription for the content:"); newContent.Description = Console.ReadLine(); //maturity rating Console.WriteLine("Enter the rating for the content(g, pg, pg-13, etc):"); newContent.MaturityRating = Console.ReadLine(); //star rating Console.WriteLine("Enter the sta count for the content 5.8, 10, 3.5, ect:"); string starsAsString = Console.ReadLine(); newContent.StarRating = double.Parse("starsAsStrings"); //isfamilyfriendly Console.WriteLine("Is this content family friendly? (y/n)"); string familyFriendlystring = Console.ReadLine().ToLower(); if (familyFriendlystring == "y") { newContent.IsFamilyFriendly = true; } else { newContent.IsFamilyFriendly = false; } //genretype Console.WriteLine("Enter the Gene number:/n" + "1. Horror/n" + "2. Romcom/n" + "3. Scify/n" + "4. Documentary/n" + "5. Romance/n" + "6. Drama/n" + "7. Action/n" + "7. Action/n"); string genreAsString = Console.ReadLine(); int genreAsInt = int.Parse(genreAsString); newContent.TypeOfGenre = (GenreType)genreAsInt; _contentRepo.AddContentToList(newContent); // Horror = 1, /* Romcom, * Scify, * Documentary, * Romance, * Drama, * Action */ }
// Create new StreamingContent private void CreateNewContent() { Console.Clear(); StreamingContent newContent = new StreamingContent(); //Made a Reference connection here to Repository and then hit CTRL + . to link. //Title Console.WriteLine("Enter the title for the content:"); newContent.Title = Console.ReadLine(); //Description Console.WriteLine("Enter the description for the content:"); newContent.Description = Console.ReadLine(); //Maturity Rating Console.WriteLine("Enter the rating for the content (G, PG, PG-13, etc):"); newContent.MaturityRating = Console.ReadLine(); //Star Rating Console.WriteLine("Enter the star count for the content (5.8, 10, 1.5, etc):"); string starsAsString = Console.ReadLine(); newContent.StarRating = double.Parse(starsAsString); //IsFamilyFriendly Console.WriteLine("Is this content family friendly?"); string familyFriendlyString = Console.ReadLine().ToLower(); if (familyFriendlyString == "y") { newContent.IsFamilyFriendly = true; } else { newContent.IsFamilyFriendly = false; } //GenreType Console.WriteLine("Enter the genre number:\n" + "1. Horror\n" + "2. RomCom\n" + "3. SciFi\n" + "4. Documentary\n" + "5. Bromance\n" + "6. Drama\n" + "7. Action"); string genreAsString = Console.ReadLine(); int genreAsInt = int.Parse(genreAsString); newContent.TypeOfGenre = (GenreType)genreAsInt; //This is Casting. Moving from string to int and casting as a specific number from the enum function. _contentRepo.AddContentToList(newContent); /* * Horror = 1, * RomCom, * SciFi, * Documentary, * Bromance, * Drama, * Action */ }
// Create new StreamingContent private void CreateNewContent() { Console.Clear(); // clears the content StreamingContent newContent = new StreamingContent(); // Creates a blank streamingcontent object; we can then immediately assign them upon user input // Title Console.WriteLine("Enter the title for the content:"); newContent.Title = Console.ReadLine(); // Description Console.WriteLine("Enter the description for the new content: "); newContent.Description = Console.ReadLine(); // Maturity Rating Console.WriteLine("Enter the rating for the content (G, PG, PG-13, etc): "); newContent.MaturityRating = Console.ReadLine(); // Star Rating Console.WriteLine("Enter the star count for the content (5.8, 10, 1.5, etc: "); string starAsString = Console.ReadLine(); newContent.StarRating = double.Parse(starAsString); // Is family friendly Console.WriteLine("Is this content family friendly (y/n): "); string familyFriendlyString = Console.ReadLine().ToLower(); //converts to lowercase if (familyFriendlyString == "y") { newContent.IsFamilyFriendly = true; } else { newContent.IsFamilyFriendly = false; } // Genre Type /*Horror =1, //resets starting value from 0 t0 1 * RomCom, * SciFi, * Documentary, * Bromance, * Drama, * Action*/ // Setting the enum numbers to input Console.WriteLine("Enter the Genre Number: /n" + "1. Horror /n" + "2. RomCom /n" + "3. SciFir /n" + "4. Documentary /n" + "5. Bromance /n" + "6. Drama /n" + "7. Action"); string genreAsString = Console.ReadLine(); int genreAsInt = int.Parse(genreAsString); newContent.TypeOfGenre = (GenreType)genreAsInt; // I have a number genreAsInt and an Enum GenreType, I am going to cast the int to the enum which is a genre type; _contentRepo.AddContentToList(newContent); }
//Create new streaming content private void CreateNewContent() { Console.Clear(); StreamingContent newContent = new StreamingContent(); //Title Console.WriteLine("Enter the title of the content: "); newContent.Title = Console.ReadLine(); //description Console.WriteLine("Enter the description for the new content: "); newContent.Description = Console.ReadLine(); //Maturity Rating Console.WriteLine("Enter the rating for the content (G, PG, PG-13, etc.): "); newContent.MaturityRating = Console.ReadLine(); //Star rating Console.WriteLine("Enter the star count for the content(5, 6.9, 10, etc.): "); string starsAsString = Console.ReadLine(); newContent.StarRating = double.Parse(starsAsString); //converts string to double //double starAsDouble = Console.Read(); //newContent.StarRating = starAsDouble; // trying out another way but doesn't work right //newContent.StarRating = Console.Read(); //tried this way but return was 56 or 57 for star rating even though input was 8 //IsfamilyFriendly Console.WriteLine("Is this content family-friendly? (y/n)"); string familyFriendlyString = Console.ReadLine().ToLower(); if (familyFriendlyString == "y") { newContent.IsFamilyFriendly = true; } else { newContent.IsFamilyFriendly = false; } //Genre Type Console.WriteLine("Enter the genre number: \n" + "1. Horror\n" + "2. RomCom\n" + "3. SciFi\n" + "4. Documentary\n" + "5. Bromance\n" + "6. Drame\n" + "7. Action\n" + "8. Comedy"); string genreAsString = Console.ReadLine(); int genreAsInt = int.Parse(genreAsString); //converts string to int newContent.TypeOfGenre = (GenreType)genreAsInt; //WHY DO I HAVE TO USE (GenreType) instead of just = genreAsInt??? _contentRepo.AddContentToList(newContent); // this line adds new created object to list }