コード例 #1
0
        private void SeedContent()
        {
            Movie futureWar = new Movie("Future War",
                                        "A war in the future", 10.0, Genre.SciFi, MaturityRating.G, 90.0);

            Movie blazingSaddles = new Movie("Blazing Saddles",
                                             "A sheriff goes to a rural town...", 9.5, Genre.Action, MaturityRating.R, 136.4);

            Movie theRoom = new Movie("The Room",
                                      "Everyone betrays Johnny and he's fed up with this world", 10.0, Genre.Documentary, MaturityRating.G, 139.0);

            Show burnNotice = new Show();

            burnNotice.Title          = "Burn Notice";
            burnNotice.MaturityRating = MaturityRating.PG_13;
            burnNotice.Description    = "A spy recently disavowed by the U.S. government uses his special ops training to help others in trouble.";
            burnNotice.Genre          = Genre.Action;

            List <Episode> episodes = new List <Episode>();
            //Make an episode and then add it
            Episode episode = new Episode();

            episode.Title = "Tikka to Ride";
            episodes.Add(episode);
            //Make and add an episode on the same line
            episodes.Add(new Episode("Break Out Games", 45, 7));
            episodes.Add(new Episode("Lesser Evil", 50, 7));

            burnNotice.Episodes = episodes;


            _repo.AddContentToDirectory(futureWar);
            _repo.AddContentToDirectory(theRoom);
            _repo.AddContentToDirectory(burnNotice);
        }
コード例 #2
0
        public void Seed()
        {
            _repo = new StreamingContent_Repo();
            StreamingContent theRoom = new StreamingContent(
                "The Room",
                "Everyone betrays Johnny and he's fed up with this world",
                Maturity.R,
                5,
                GenreType.Romance
                );
            StreamingContent spaceballs = new StreamingContent(
                "Spaceballs",
                "fun in space",
                Maturity.PG,
                5,
                GenreType.Comedy
                );

            _repo.AddContentToDirectory(theRoom);
            _repo.AddContentToDirectory(spaceballs);

            _content = new StreamingContent(
                "Groundhog Day",
                "Bill Murray gets caught in a time loop for no reason",
                Maturity.PG,
                5,
                GenreType.Drama
                );
            _repo.AddContentToDirectory(_content);
        }
コード例 #3
0
        private void CreateNewContent()
        {
            Console.Clear();

            StreamingContent content = new StreamingContent();

            // Title
            Console.WriteLine("Please enter a title: ");
            content.Title = Console.ReadLine();

            // Description
            Console.WriteLine("Please enter a description: ");
            content.Description = Console.ReadLine();

            //Star rating
            Console.WriteLine("Please enter the star rating (1-5): ");
            content.StarRating = double.Parse(Console.ReadLine());

            // Maturity
            Console.WriteLine("Select a Maturity Rating: \n" +
                              "1. G\n" +
                              "2. PG\n" +
                              "3. R\n" +
                              "4. PG13\n" +
                              "5. NC17\n" +
                              "6. TVY\n" +
                              "7. TVY7\n" +
                              "8. TVMA\n" +
                              "9. TVPG");

            string maturityString = Console.ReadLine();

            int maturityId = int.Parse(maturityString);

            content.MaturityRating = (Maturity)maturityId;

            // Genre

            Console.WriteLine("Select a Genre:\n" +
                              "1. Horror\n" +
                              "2. Comedy\n" +
                              "3. SciFi\n" +
                              "4. Drama\n" +
                              "5. Romance\n" +
                              "6. Romans\n" +
                              "7. Action\n" +
                              "8. International");

            string genreInput = Console.ReadLine();
            int    genreId    = int.Parse(genreInput);

            content.GenreType = (GenreType)genreId;

            _repo.AddContentToDirectory(content);
        }
コード例 #4
0
        public void Seed()
        {
            _repo = new StreamingContent_Repo();
            StreamingContent theRoom = new StreamingContent(
                "The Room",
                "Everyone betrays Johnny and he's feed up with this world",
                Maturity.R,
                5,
                GenreType.Romance
                );
            StreamingContent spaceballs = new StreamingContent(
                "Spaceballs",
                "fun in space",
                Maturity.PG,
                5,
                GenreType.Comedy
                );

            _repo.AddContentToDirectory(theRoom);
            _repo.AddContentToDirectory(spaceballs);


            _content = new StreamingContent(
                "Groundhog Day",
                "Bill Murray gets caught in a time loop for no reason",
                Maturity.PG,
                5,
                GenreType.Drama
                );
            _repo.AddContentToDirectory(_content);


            Show show = new Show();

            show.Title       = "Arrested Development";
            show.SeasonCount = 4;
            Episode ep = new Episode();

            ep.Title = "Courting Disasters";
            Episode ep2 = new Episode();

            ep2.Title = "Pier Pressire";

            _repo.AddContentToDirectory(show);

            Movie movie = new Movie();

            movie.Title       = "Roller Blade";
            movie.Description = "In a world of blood and greed, curvaceous crusafers battle to rebuilt a battered land.";

            _repo.AddContentToDirectory(movie);
        }
コード例 #5
0
        private void SeedContent()
        {
            Movie futureWar = new Movie(
                "Future War",
                "a war in the future",
                10.0,
                Genre.SciFi,
                MaturityRating.PG_13,
                90.0
                );

            Movie theRoom = new Movie(
                "The Room",
                "Everyone betrays Johnny and he's fed up with this world",
                10.0,
                Genre.Documentary,
                MaturityRating.R,
                99.0
                );
            Show redDwarf = new Show();

            redDwarf.Title          = "Red Dwarf";
            redDwarf.MaturityRating = MaturityRating.PG;
            redDwarf.Description    = "A human, a robot, a hologram and a cat try to survive 3 million years into deep space.";
            redDwarf.Genre          = Genre.SciFi;
            List <Episode> episodes = new List <Episode>();

            episodes.Add(new Episode("The End", 45, 1));
            episodes.Add(new Episode("Psirens", 45, 6));
            Episode episode = new Episode();

            episode.Title = "Tikka to Ride";
            episodes.Add(episode);
            redDwarf.Episodes = episodes;

            Episode pilot = new Episode();

            Episode ep2       = new Episode();
            Show    theOffice = new Show();

            theOffice.Title = "The Office";

            theOffice.Episodes.Add(ep2);
            theOffice.Episodes.Add(pilot);
            _repo.AddContentToDirectory(futureWar);
            _repo.AddContentToDirectory(theRoom);
            _repo.AddContentToDirectory(theOffice);
            _repo.AddContentToDirectory(redDwarf);
        }
コード例 #6
0
        public void AddTest()
        {
            // AAA Testing Pattern
            // Arrange
            // Act
            // Assert

            // Arrange
            StreamingContent content = new StreamingContent(
                "Galaxy Quest",
                "Sci Fi actors go on real Sci Fi adventure",
                Maturity.PG13,
                5,
                GenreType.Comedy
                );

            // Act
            bool wasAdded = _repo.AddContentToDirectory(content);

            Console.WriteLine(_repo.Count);
            Console.WriteLine(wasAdded);
            Console.WriteLine(content.Title);

            // Assert
            Assert.IsTrue(wasAdded);
        }
コード例 #7
0
ファイル: ProgramUI.cs プロジェクト: Evan-Lacy/SDLessons69
        private void SeedContent()
        {
            StreamingContent futureWar = new StreamingContent("Future War",
                                                              "A war in the future", 10.0, Genre.SciFi, MaturityRating.G);

            StreamingContent blazingSaddles = new StreamingContent("Blazing Saddles",
                                                                   "A sheriff goes to a rural town...", 9.5, Genre.Action, MaturityRating.R);



            StreamingContent theRoom = new StreamingContent("The Room",
                                                            "Everyone betrays Johnny and he's fed up with this world", 10.0, Genre.Documentary, MaturityRating.G);

            _repo.AddContentToDirectory(futureWar);
            _repo.AddContentToDirectory(theRoom);
        }
コード例 #8
0
        private void SeedContent()
        {
            Movie futureWar = new Movie(
                "Future War",
                "a war in the future",
                10.0,
                Genre.SciFi,
                MaturityRating.G,
                90.0
                );
            Movie theRoom = new Movie(
                "The Room",
                "Everyone betrays Johnny and he's fed up with this world",
                10.0,
                Genre.Documentary,
                MaturityRating.G,
                99.0
                );
            Show redDwarf = new Show();

            redDwarf.Title          = "Red Dwarf";
            redDwarf.MaturityRating = MaturityRating.PG;
            redDwarf.Description    = "A human, a robot, a hologram, and a cat try to survive 3 million years into deep space. Hilarity ensues.";
            redDwarf.Genre          = Genre.SciFi;

            List <Episode> episodes = new List <Episode>();
            // Make an episode and then add it
            Episode episode = new Episode();

            episode.Title        = "Tikka to Ride";
            episode.SeasonNumber = 7;
            episodes.Add(episode);
            // Make and add an episode on the same line
            episodes.Add(new Episode("The End", 45, 1));
            episodes.Add(new Episode("Psirens", 45, 6));

            redDwarf.Episodes = episodes;

            _repo.AddContentToDirectory(futureWar);
            _repo.AddContentToDirectory(theRoom);
            _repo.AddContentToDirectory(redDwarf);
        }
コード例 #9
0
        public void AddToDirectory_ShouldGetCorrectBoolean()
        {
            //Arrange
            StreamingContent      content    = new StreamingContent();
            StreamingContent_Repo repository = new StreamingContent_Repo();
            //Act
            bool addResult = repository.AddContentToDirectory(content);

            //Assert
            Assert.IsTrue(addResult);
        }
コード例 #10
0
ファイル: ProgramUI.cs プロジェクト: sayorinde/SDLessons69
        private void SeedContent()
        {
            StreamingContent futureWar = new StreamingContent(
                "Future War",
                "a war in the future",
                10.0,
                Genre.SciFi,
                MaturityRating.G
                );
            StreamingContent theRoom = new StreamingContent(
                "The Room",
                "Everyone betrays Johnny and he's fed up with this world",
                10.0,
                Genre.Documentary,
                MaturityRating.G
                );

            _repo.AddContentToDirectory(futureWar);
            _repo.AddContentToDirectory(theRoom);
        }
コード例 #11
0
        public void AddToDirectory_ShouldGetCorrectBoolean()
        {
            //Arrange– setup the testing objects and prepare the prerequisites for your test.

            StreamingContent      content    = new StreamingContent();
            StreamingContent_Repo repository = new StreamingContent_Repo();

            //Act– perform the actual work of the test.

            bool addResult = repository.AddContentToDirectory(content);

            //Assert– verify the result.
            Assert.IsTrue(addResult);
        }
コード例 #12
0
        public void GetDirectory_ShouldReturnCorrectCollection()
        {
            //Arrange
            StreamingContent      content = new StreamingContent();
            StreamingContent_Repo repo    = new StreamingContent_Repo();

            repo.AddContentToDirectory(content);
            //Act
            List <StreamingContent> contents = repo.GetContents();

            bool directoryHasContent = contents.Contains(content);//checking if contents contains the contents from the directory

            //Assert
            Assert.IsTrue(directoryHasContent);
        }
コード例 #13
0
        public void GetByTitle_ShouldReturnCorrectConents()
        {
            //Arrange
            StreamingContent_Repo repo       = new StreamingContent_Repo();
            StreamingContent      newContent = new StreamingContent("Toy Story", "Toys come to life", 10, Genre.Action, MaturityRating.G);

            repo.AddContentToDirectory(newContent);
            string title = "Toy Story";

            //ACT
            StreamingContent searchResult = repo.GetContentByTitle(title);

            //Assert
            Assert.AreEqual(searchResult.Title, title);
        }
コード例 #14
0
        public void UpdateExistingContent_ShouldReturnTrue()
        {
            //Arrange
            StreamingContent_Repo repo       = new StreamingContent_Repo();
            StreamingContent      oldContent = new StreamingContent("Toy Story", "Toys come to life", 8, Genre.Documentary, MaturityRating.PG);
            StreamingContent      newContent = new StreamingContent("Toy Story", "Toys come to life", 10, Genre.Action, MaturityRating.G);

            repo.AddContentToDirectory(oldContent);

            // Act

            bool updateResult = repo.UpdateExistingContent(oldContent.Title, newContent);

            //Assert
            Assert.IsTrue(updateResult);
        }
コード例 #15
0
        public void DeleteExistingContent_ShouldReturnTrue()
        {
            //Arrange
            StreamingContent_Repo repo    = new StreamingContent_Repo();
            StreamingContent      content = new StreamingContent("Toy Story", "Toys come to life", 8, Genre.Drama, MaturityRating.PG);

            repo.AddContentToDirectory(content);

            //Act
            StreamingContent oldContent = repo.GetContentByTitle("Toy Story");

            bool removeResult = repo.DeleteExistingContent(oldContent);

            //Assert
            Assert.IsTrue(removeResult);
        }
コード例 #16
0
        private void CreateNewContent()
        {
            Console.Clear();

            StreamingContent newContent = new StreamingContent();

            Console.WriteLine("Please enter a title.");
            newContent.Title = Console.ReadLine();

            Console.WriteLine("Please enter a description.");
            newContent.Description = Console.ReadLine();

            Console.WriteLine("Please enter a star rating (1.0 - 10.0) for this content.");
            string ratingAsString = Console.ReadLine();
            double ratingAsDouble = double.Parse(ratingAsString);

            newContent.StarRating = ratingAsDouble;

            Console.WriteLine("Select a genre.");
            Console.WriteLine("1.Horror");
            Console.WriteLine("2.RomCom");
            Console.WriteLine("3.SciFi");
            Console.WriteLine("4.Action");
            Console.WriteLine("5.Documentary");
            Console.WriteLine("6.Musical");
            Console.WriteLine("7.Drama");
            Console.WriteLine("8.Mystery");

            string genreInput = Console.ReadLine();
            int    genreAsInt = int.Parse(genreInput);

            newContent.Genre = (Genre)genreAsInt;


            bool stopRunning = false;

            while (!stopRunning)
            {
                Console.WriteLine("Select a maturity rating.");
                Console.WriteLine("1. G");
                Console.WriteLine("2. PG");
                Console.WriteLine("3. PG_13");
                Console.WriteLine("4. R");
                Console.WriteLine("5. NC_17");

                string maturityRating = Console.ReadLine();


                switch (maturityRating)
                {
                case "1":
                    newContent.MaturityRating = MaturityRating.G;
                    stopRunning = true;
                    break;

                case "2":
                    newContent.MaturityRating = MaturityRating.PG;
                    stopRunning = true;
                    break;

                case "3":
                    newContent.MaturityRating = MaturityRating.PG_13;
                    stopRunning = true;
                    break;

                case "4":
                    newContent.MaturityRating = MaturityRating.R;
                    stopRunning = true;
                    break;

                case "5":
                    newContent.MaturityRating = MaturityRating.NC_17;
                    stopRunning = true;
                    break;

                default:
                    Console.WriteLine("Please enter a valid input.");
                    stopRunning = false;
                    break;
                }
            }
            bool wasAdded = _repo.AddContentToDirectory(newContent);

            if (wasAdded == true)
            {
                Console.WriteLine("Your content was succesfully added.");
            }
            else
            {
                Console.WriteLine("Oops something went wrong. Your content was not added.");
            }
        }