public List <Movie> GetMovieByRating(MaturityRating rating)
        {
            List <Movie> maturityMovie = new List <Movie>();

            foreach (StreamingContent content in _contentDirectory)
            {
                if (content is Movie && content.MaturityRating == rating) // if streaningcontent is of contnet movie && content.Maturity rating is equal to given the parameter
                {
                    maturityMovie.Add((Movie)content);                    // casts the object content of the class streamingContent to become a movie content
                }

                //the only way we get to properties of an object is through our dot operator .

                //if(content is movie) {}
                //if (content.GetType() == typeof(Movie)){}
                //if

                //Movie newMovie = (Movie)content; // casting a streamingContent type to a movie type
                //if(newMovie.MaturityRating == x)
                //{
                //    maturityMovie.Add(newMovie);
                //}
            }

            if (maturityMovie.Count > 0)
            {
                return(maturityMovie);
            }

            else
            {
                return(null); // will return nothing if their is no movies that matches the users desired maturityRating
            }
        }
        //Add New Content
        public void CreateNewContent()
        {
            // Gather values for all properties for the StreamingContent object
            // Title
            _console.WriteLine("Enter a title: ");
            string title = _console.ReadLine();

            // Description
            _console.WriteLine("Enter a description: ");
            string description = _console.ReadLine();

            // MaturityRating
            MaturityRating maturityRating = GetMaturityRating();

            // StarRating
            _console.Write("Enter the star rating (1-5): ");
            // maybe refactor later so it won't break when not given a #
            double starRating = double.Parse(_console.ReadLine());

            // ReleaseYear
            _console.Write("Enter the release year: ");
            int releaseYear = int.Parse(_console.ReadLine());

            // GenreType
            GenreType genre = GetGenreType();

            // Construct a StreamingContent object given the above values
            StreamingContent newContent = new StreamingContent(title, description, maturityRating, starRating, releaseYear, genre);

            // Add the StreamingContent object to the repository ("Save" the content)
            _streamingRepo.AddContentToDirectory(newContent);
        }
        public void SetMaturityRating_ShouldGetCorrectBool(MaturityRating rating, bool isFamilyFriendly)
        {
            StreamingContent content  = new StreamingContent("Insert Title Here", "Description Here", 5, rating, GenreType.Documentary);
            bool             actual   = content.IsFamilyFriendly;
            bool             expected = isFamilyFriendly;

            Assert.AreEqual(expected, actual);
        }
        }                                                                                                                               //empty constructor

        public StreamingContent(string title, string description, MaturityRating maturityRating, int starRating, GenreType typeOfGenre) //overloaded constructor **ctor tab will build out a constructor
        {
            Title          = title;                                                                                                     //defining variables
            Description    = description;
            MaturityRating = maturityRating;
            StarRating     = starRating;
            TypeOfGenre    = typeOfGenre;
        }
        }                                                                                                                        // kind of like a default constructor which allows for us to use either an empty constructor or overloaded constructor

        public StreamingContent(string title, string description, MaturityRating maturityRating, double rating, GenreType genre) // ctor tab tab will build empty constructor
        {
            Title          = title;
            Description    = description;
            MaturityRating = maturityRating;
            StarRating     = rating;
            TypeOfGenre    = genre;
        }
Example #6
0
        }                                   // ctor + double tab will quickly build an empty constructor

        public StreamingContent(string title, string description, MaturityRating maturityRating, int starRating, GenreType genre)
        {
            Title          = title;
            Description    = description;
            MaturityRating = maturityRating;
            StarRating     = starRating;
            TypeOfGenre    = genre;
        }
 //Constructors
 public StreamingContent(string title, string description, float starRating, MaturityRating mRating, GenreType tOG)
 {
     Title          = title;
     Description    = description;
     StarRating     = starRating;
     MaturityRating = mRating;
     TypeOfGenre    = tOG;
 }
Example #8
0
 public StreamingContent(string title, string description, double starRating, GenreType typeOfGenre, MaturityRating maturityRating)
 {
     Title          = title;
     Description    = description;
     StarRating     = starRating;
     TypeOfGenre    = typeOfGenre;
     MaturityRating = maturityRating;
 }
 public StreamingContentBase(string title, string description, double starRating, Genre genre, MaturityRating maturityRating)
 {
     Title          = title;
     Description    = description;
     StarRating     = starRating;
     Genre          = genre;
     MaturityRating = maturityRating;
 }
Example #10
0
        public void SetMaturityRating_ShouldGetCorrectIsFamilyFriendly(MaturityRating rating, bool expectedIsFamilyFriendly)
        {
            StreamingContent newContent = new StreamingContent("Back to the Future", "A high school student named Marty get accidentally sent back in time 30 years", 4.4, GenreType.SciFi, rating);

            bool actual   = newContent.IsFamilyFriendly;
            bool expected = expectedIsFamilyFriendly;

            Assert.AreEqual(actual, expected);
        }
        //public StreamingContent(string title, string description, MaturityRating maturityRating, int starRating, bool isFamilyFriendly, GenreType typeOfGrenre)

        // AFter we built our switch, we need to remove isFamilyFriendly
        public StreamingContent(string title, string description, MaturityRating maturityRating, int starRating, GenreType typeOfGrenre)
        {
            Title          = title;
            Description    = description;
            MaturityRating = maturityRating;
            StarRating     = starRating;
            // IsFamilyFriendly = isFamilyFriendly;
            TypeOfGenre = typeOfGrenre;
        } //  StreamingContent overloaded constructor
        }                             //-- 'ctor' shortcut to build a constructor. We make an empty constrcuctor to replace the 'hidden' empty constructor that is there in the background.

        public StreamingContent(string title, string description, MaturityRating maturityRating, int starRating, GenreType typeOfGenre)
        {
            //--Match up the parameters with the properties
            Title          = title;
            Description    = description;
            MaturityRating = maturityRating;
            StarRating     = starRating;
            TypeOfGenre    = typeOfGenre;
        }
        //constructors serve as a kind of validation allow us to "new up", or instantiate, an object while ensuring that all necessary data is given at the point of construction , aka instantiation(below)
        public StreamingContent(string title, string description, MaturityRating maturityRating, int starRating, GenreType typeOfGenre)

        {
            Title          = title;//this is our set method: we are setting the value of our property Title to whatever the arguement of our the variable "title"  declared in the prarmeters of our constructor
            Description    = description;
            MaturityRating = maturityRating;
            StarRating     = starRating;
            TypeOfGenre    = typeOfGenre;
        }
 public StreamingContent(string title, string description, float starRating, MaturityRating mRating, bool famFriendly, GenreType tOG)
 {
     Title         = title;
     Description   = description;
     StarRating    = starRating;
     MaturityRatin = mRating;
     //IsFamilyFriendly = famFriendly;
     TypeOfGenre = tOG;
 }
Example #15
0
 public StreamingContent(string title, string description, MaturityRating maturityRating, double starRating, int releaseYear, GenreType genre)
 {
     Title          = title;
     Description    = description;
     MaturityRating = maturityRating;
     StarRating     = starRating;
     ReleaseYear    = releaseYear;
     Genre          = genre;
 }
Example #16
0
        public void SetMaturityRating_ShouldGetCorrectIsFamilyFriendly(MaturityRating rating, bool isFriendly)
        {
            StreamingContent content = new StreamingContent("Content Genre", "Content Title", 1, StreamingQuality.HD1080, "Content Description", "Content Language", rating);

            bool actual   = content.IsFamilyFriendly;
            bool expected = isFriendly;

            Assert.AreEqual(actual, expected);
        }
        public void SetMaturityRating_ShouldGetCorrectIsFamilyFriendly(MaturityRating rating, bool isFriendly)
        {
            StreamingContent content = new StreamingContent("Genre", "Title", 4, StreamingQualityType.HD720, "description", "English", rating);

            bool actual   = content.IsFamilyFriendly;
            bool expected = isFriendly;

            Assert.AreEqual(expected, actual);
        }
Example #18
0
 public StreamingContent(string genre, string title, int starRating, StreamingQuality typeOfQuality, string description, string language, MaturityRating maturityRating)
 {
     Genre                  = genre;
     Title                  = title;
     StarRating             = starRating;
     TypeOfStreamingQuality = typeOfQuality;
     Description            = description;
     Language               = language;
     MaturityRating         = maturityRating;
 }
Example #19
0
 public StreamingContent GetContentByMaturityRating(MaturityRating mRating)
 {
     foreach (StreamingContent movie in _contentDirectory)
     {
         if (movie.MRating == mRating)
         {
             return(movie);
         }
     }
     return(null);
 }
Example #20
0
 //GetByMaturityRating
 public Show GetShowByMaturityRating(MaturityRating mRating)
 {
     foreach (StreamingContent show in _contentDirectory)
     {
         if (show.MRating == mRating && show.GetType() == typeof(Show))
         {
             return((Show)show);
         }
     }
     return(null);
 }
Example #21
0
 public Movie GetMovieByMaturityRating(MaturityRating mRating)
 {
     foreach (StreamingContent movie in _contentDirectory)
     {
         if (movie.MRating == mRating && movie.GetType() == typeof(Movie))
         {
             return((Movie)movie);
         }
     }
     return(null);
 }
Example #22
0
        public void SetMaturityRating_ShouldGetCorrectIsFamilyFriend(MaturityRating rating, bool expectedFamilyFriendly)
        {
            // Arrange
            StreamingContent content = new StreamingContent();

            // Act
            content.MaturityRating = rating;

            // Assert
            Assert.AreEqual(expectedFamilyFriendly, content.IsFamilyFriendly);
        }
Example #23
0
 public Games(
     string title,
     MaturityRating rating,
     string description,
     TypeofGame typeofGame)
 {
     Title       = title;
     Rating      = rating;
     Description = description;
     TypeGame    = typeofGame;
 }
        public void SetMaturityRatingShouldGetCorrectIsFamilyFriendly(
            MaturityRating rating,
            bool expectedFamilyFriendly)
        {
            StreamingContent content = new StreamingContent();

            content.MaturityRating = rating;
            bool actual = content.IsFamilyFriendly;

            Assert.AreEqual(expectedFamilyFriendly, actual);
        }
Example #25
0
        //Build Method
        //Get by other parameters
        //Get by Rating
        //Get by FamilyFriendly
        //Etc.



        public List <StreamingContent> GetbyMaturity(MaturityRating x)      // streamingContent return type with the return type being MaturityRating named x, which would be user input
        {
            List <StreamingContent> rating = new List <StreamingContent>(); //creates new instance of list with return type of StreamingContent named ratingList

            foreach (StreamingContent ageItems in _contentDirectory)        // foreach item in the _contentDirectory with the type being StreamingContent and the name being rating
            {
                if (ageItems.MaturityRating == x)                           //if the MaturityRating of the ageRating with type streamingContent is equal to
                {
                    rating.Add(ageItems);                                   //add the variable ageRating to the ratingList list
                }
            }
            return(rating); //if it is equal just return the ratingList
        }
        //Get Shows/Movie by Rating
        public List<StreamingContent> GetContentByRating(MaturityRating rating)
        {
            List<StreamingContent> listOfContent = new List<StreamingContent>();

            foreach(StreamingContent content in _contentDirectory)
            {
                if(content.MaturityRating == rating)
                {
                    listOfContent.Add(content);
                }
            }
            return listOfContent;
        }
Example #27
0
        // Challenge: get shows/movies by rating
        public List <Show> GetShowsByMaturityRating(MaturityRating maturityRating)
        {
            List <Show> shows = new List <Show>();

            foreach (StreamingContent content in _contentDirectory)
            {
                if (content is Show show && show.MaturityRating == maturityRating)
                {
                    shows.Add(show);
                }
            }
            return(shows);
        }
Example #28
0
        public List <Movie> GetMoviesByMaturityRating(MaturityRating maturityRating)
        {
            List <Movie> movies = new List <Movie>();

            foreach (StreamingContent content in _contentDirectory)
            {
                if (content is Movie movie && movie.MaturityRating == maturityRating)
                {
                    movies.Add(movie);
                }
            }
            return(movies);
        }
        //Get Shows/Movie By Rating
        public List <Movie> GetMoviesByRating(MaturityRating rating)
        {
            List <Movie> moviesByRating = new List <Movie>();

            foreach (StreamingContent content in _contentDirectory)
            {
                if (content is Movie && content.MaturityRating == rating)
                {
                    moviesByRating.Add((Movie)content);
                }
                return(moviesByRating);
            }
            return(null);
        }
Example #30
0
 public Movie(
     string title,
     string description,
     double starRating,
     double runTime,
     double boxOffice,
     MaturityRating maturityRating,
     GenreType genre
     )
     : base(title, description, starRating, maturityRating, genre)
 {
     RunTime       = runTime;
     BoxOfficeTake = boxOffice;
 }