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);
        }
コード例 #2
0
        public void StreamingContentRepository_GetStreamingContentByGenre_ShouldReturnCorrectListCount()
        {
            //Testing a method that returns a new list with filtered results based on genre
            // Arrange
            StreamingContentRepository _contentRepo = new StreamingContentRepository();

            //Three instances of the StreamingContent class, our POCO (Plain Old CSharp Object) with value for the genre property.
            StreamingContent content = new StreamingContent();

            content.Genre = Genre.Action;
            StreamingContent contentTwo = new StreamingContent();

            contentTwo.Genre = Genre.Action;
            StreamingContent contentThree = new StreamingContent();

            contentThree.Genre = Genre.Bromance;

            _contentRepo.AddContentToList(content);
            _contentRepo.AddContentToList(contentTwo);
            _contentRepo.AddContentToList(contentThree);

            // Act
            int actual   = _contentRepo.GetStreamingContentByGenre(Genre.Action).Count;
            int expected = 2;

            // Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        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", "Car tire comes to life and goes on a killing spree.", "R", 5.8, false, GenreType.Documentary);

            _repo.AddContentToList(_content);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        public void Arrange()

        {
            _repo    = new StreamingContentRepository();
            _content = new StreamingContent("Mr. Right", "Hitman falls in love", MaturityRating.R, 100, GenreType.Action);
            _repo.AddContentToDirectory(_content);
        }
コード例 #8
0
        public void Arrange()
        {
            _repo    = new StreamingContentRepository();
            _content = new StreamingContent("Spirited Away", "An animated film where a girl gets lost in a world of spirits", MaturityRating.PG, 100, GenreType.Anime);

            _repo.AddContentToDirectory(_content);
        }
        public void GetDirectory_ShouldReturnCorrectCollection()
        {
            // ARRANGE
            StreamingContent           newMovie     = new StreamingContent();
            StreamingContent           anotherMovie = new StreamingContent();
            StreamingContentRepository repo         = new StreamingContentRepository();

            repo.AddContentToDirectory(newMovie);
            repo.AddContentToDirectory(anotherMovie);

            // ACT
            List <StreamingContent> listOfContents = repo.GetContents();

            // ASSERT
            bool directoryHasContent = listOfContents.Contains(newMovie);

            Console.WriteLine(directoryHasContent);
            Console.WriteLine()
            ;
            int count = listOfContents.Count;

            Console.WriteLine(count);
            Console.WriteLine();

            Console.WriteLine(listOfContents[0]);
            Console.WriteLine(listOfContents[1]);
        }
        public void Arrange()
        {
            _repo    = new StreamingContentRepository();
            _content = new StreamingContent("Rubber", "A car tyre comes to life with the power to make people explode and goes on a murderous rampage through the Californian desert.", MaturityRating.R, 5.8, 2010, GenreType.Thriller);

            _repo.AddContentToDirectory(_content);
        }
コード例 #11
0
        public void AddToDirectory_ShouldGetCorrectBool()
        {
            StreamingContent           content = new StreamingContent();//breakpoint here to test
            StreamingContentRepository repo    = new StreamingContentRepository();
            bool addResult = repo.AddContentToDirectory(content);

            Assert.IsTrue(addResult);
        }
        [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);                                                                                      //
        }
コード例 #13
0
        public void AddToDirectory_ShouldGetCorrectBoolean()
        {
            StreamingContent           content    = new StreamingContent();
            StreamingContentRepository repository = new StreamingContentRepository();

            bool addResult = repository.AddContentToDirectory(content);

            Assert.IsTrue(addResult);
        }
コード例 #14
0
        public void StreamingContentRepository_GetGenreFromInt_ShouldReturnCorrectEnumValue(int x, Genre y)
        {
            // Arrange
            StreamingContentRepository _contentRepo = new StreamingContentRepository();

            // Act
            var actual = _contentRepo.GetGenreFromInt(x);

            // Assert
            Assert.AreEqual(y, actual);
        }
コード例 #15
0
        public void AddToDirectory_ShouldGetCorrectBoolean()
        {
            //Triple A Paradigm - Arrange
            StreamingContent           content    = new StreamingContent();
            StreamingContentRepository repository = new StreamingContentRepository();
            //ACT
            bool addResult = repository.AddContentToDirectory(content);

            //ASSERT - verify expected outcome
            Assert.IsTrue(addResult);
        }
コード例 #16
0
        public void AddToDirectory_ShouldGetCorrectBool()
        {
            //Arrange
            StreamingContent           content = new StreamingContent();
            StreamingContentRepository repo    = new StreamingContentRepository();
            //Act
            bool addResult = repo.AddContentToDirectory(content);

            //Assert
            Assert.IsTrue(addResult);
        }
コード例 #17
0
        public void GetDirectory_ShouldReturnCorrectList()//variables inside method cannot be called outside method
        {
            StreamingContent           testContent = new StreamingContent();
            StreamingContentRepository repo        = new StreamingContentRepository();

            repo.AddContentToDirectory(testContent);
            List <StreamingContent> testList = repo.GetContent();
            bool directoryHasContent         = testList.Contains(testContent);

            Assert.IsTrue(directoryHasContent);
        }
        public void GetContents_ShouldReturnCorrectCollection()
        {
            //Arrange
            StreamingContent           content = new StreamingContent();
            StreamingContentRepository repo    = new StreamingContentRepository();

            repo.AddContentToDirectory(content);
            //Act
            List <StreamingContent> contents = repo.GetContents();
            bool directoryHasContent         = contents.Contains(content);
            //Assert.IsTrue(directoryHasContent);
        }
コード例 #19
0
        public void AddToDirectory_ShouldGetCorrectBoolean()
        {
            //Arrange
            StreamingContent           content    = new StreamingContent();
            StreamingContentRepository repository = new StreamingContentRepository();//new instance of the repository

            //act
            bool addResult = repository.AddContentToDirectory(content); //method returns a bool

            //assert
            Assert.IsTrue(addResult);//did it do what we wanted it to do?
        }
コード例 #20
0
        public void GetDir_ShouldReturnRightCollection()
        {
            StreamingContent           content = new StreamingContent();
            StreamingContentRepository repo    = new StreamingContentRepository();

            repo.AddContentToDirectory(content);

            List <StreamingContent> conts = repo.ReadContentFromDirectory();

            bool directorycontainsthings = conts.Contains(content);

            Assert.IsTrue(directorycontainsthings);
        }
コード例 #21
0
        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);
        }
コード例 #22
0
        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);
        }
コード例 #23
0
        public void EditPropertyOfAMovie_CheckEditFromMethodIsCorrect()
        {
            //Arrange
            StreamingContentRepository streamingRepo = new StreamingContentRepository();
            List <StreamingContent>    contents      = streamingRepo.GetStreamingContentList();

            StreamingContent contentThree = new StreamingContent("Jaws", 10, 2.12f, "A big shark.", true, "R", GenreType.Action);
            StreamingContent contentFour  = new StreamingContent("Star Wars", 10, 1.46f, "A long time ago...", true, "PG-13", GenreType.SciFi);

            //Act
            streamingRepo.AddToList(contentThree);
            streamingRepo.AddToList(contentFour);
        }
コード例 #24
0
        public void GetDirectory_SHouldReturnCorrectCollection()
        {
            StreamingContent           content = new StreamingContent();
            StreamingContentRepository repo    = new StreamingContentRepository();

            repo.AddContentToDirectory(content);

            List <StreamingContent> contents = repo.GetAllContents();

            bool directoryHasContent = contents.Contains(content);

            Assert.IsTrue(directoryHasContent);
        }
コード例 #25
0
        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);
        }
コード例 #26
0
        public void GetDirectory_ShouldReturnCorrectList()
        {
            //Arange
            StreamingContent           testContent = new StreamingContent();
            StreamingContentRepository repo        = new StreamingContentRepository();

            repo.AddContentToDirectory(testContent);
            //Act
            List <StreamingContent> testList = repo.GetContent();
            bool directoryHasContent         = testList.Contains(testContent);

            //Assert
            Assert.IsTrue(directoryHasContent);
        }
コード例 #27
0
        public void GetContentByTitle_GetContentByValidString_ObjectsShouldBeTheSame()
        {
            // Arrange
            StreamingContentRepository streamingRepo = new StreamingContentRepository();
            StreamingContent           content       = new StreamingContent("Toy Story", 3, 1.25f, "toys", true, "G", GenreType.Comedy);

            // Act
            streamingRepo.AddToList(content);

            StreamingContent actual = streamingRepo.GetContentByTitle("Toy Story");

            // Assert
            Assert.AreEqual(content, actual);
        }
コード例 #28
0
        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);
        }
コード例 #29
0
        public void PrintMovieInfoToConsoleTest()
        {
            //Arrange
            StreamingContentRepository streamingRepo = new StreamingContentRepository();
            List <StreamingContent>    contents      = streamingRepo.GetStreamingContentList();

            StreamingContent contentThree = new StreamingContent("Jaws", 10, 2.12f, "A big shark.", true, "R", GenreType.Action);
            StreamingContent contentFour  = new StreamingContent("Star Wars", 10, 1.46f, "A long time ago...", true, "PG-13", GenreType.SciFi);

            //Act
            streamingRepo.AddToList(contentThree);
            streamingRepo.AddToList(contentFour);

            PrintMovieInfoToConsoleTest();
        }
コード例 #30
0
        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);
        }