public void CanClearStream()
        {
            // Arrange

            var stream = new VideoStream();

            stream.AddVideo(new Video
            {
                Id   = "001",
                Name = "One",
            });

            stream.AddVideo(new Video
            {
                Id   = "002",
                Name = "Two",
            });

            stream.AddVideo(new Video
            {
                Id   = "003",
                Name = "One",
            });

            // Act

            var video1 = stream.ClearStream();
            var video2 = stream.SizeOfStream();

            // Assert

            Assert.True(video1);
            Assert.Equal(0, video2);
        }
        public void CanMeasureSize()
        {
            // Arrange

            var stream = new VideoStream();

            stream.AddVideo(new Video
            {
                Id   = "001",
                Name = "One",
            });

            stream.AddVideo(new Video
            {
                Id   = "002",
                Name = "Two",
            });

            stream.AddVideo(new Video
            {
                Id   = "001",
                Name = "One",
            });

            // Act

            var video1 = stream.SizeOfStream();

            // Assert

            Assert.Equal(2, video1);
        }
        public void CanAssertSimilarComparisonCriteria()
        {
            // Arrange

            var vid = new Video
            {
                Id       = "004",
                Name     = "sth",
                Category = { "action", "drama" }
            };

            var stream = new VideoStream();

            stream.AddVideo(new Video
            {
                Id       = "001",
                Name     = "One",
                Category = { "action", "drama", "blues" }
            });

            stream.AddVideo(new Video
            {
                Id       = "005",
                Name     = "One",
                Category = { "action", "comedy" }
            });

            stream.AddVideo(new Video
            {
                Id       = "002",
                Name     = "Two",
                Category = { "action", "something", "drama" }
            });

            stream.AddVideo(new Video
            {
                Id       = "003",
                Name     = "One",
                Category = { "drama" }
            });

            // Act

            var recc   = new Recommendation();
            var result = recc.SimilarAndMixedComparisonCriterias(Video.SimilarCategory, vid, stream.Stream);

            // Assert

            Assert.Equal("001", result[0].Id);
            Assert.Equal("005", result[1].Id);
            Assert.Equal("002", result[2].Id);
            Assert.Equal(3, result.Count);
        }
        public void CanAssertIdenticalComparisonCriteria()
        {
            // Arrange

            var vid = new Video
            {
                Id       = "004",
                Name     = "sth",
                Category = { "action", "drama" }
            };

            var stream = new VideoStream();

            stream.AddVideo(new Video
            {
                Id       = "001",
                Name     = "One",
                Category = { "action", "drama" }
            });

            stream.AddVideo(new Video
            {
                Id       = "005",
                Name     = "One",
                Category = { "action", "comedy" }
            });

            stream.AddVideo(new Video
            {
                Id       = "002",
                Name     = "Two",
                Category = { "action", "something", "drama" }
            });

            stream.AddVideo(new Video
            {
                Id       = "003",
                Name     = "One",
                Category = { "drama" }
            });

            // Act

            var recc   = new Recommendation();
            var result = recc.IdenticalComparisonCriterias(Video.SameCategory, vid, stream.Stream);

            // Assert

            Assert.Equal("001", result[0].Id);
            Assert.Single(result);
        }
        public void CanRemoveVideo()
        {
            // Arrange

            var stream = new VideoStream();

            stream.AddVideo(new Video
            {
                Id   = "001",
                Name = "One",
            });

            stream.AddVideo(new Video
            {
                Id   = "002",
                Name = "Two",
            });

            stream.AddVideo(new Video
            {
                Id   = "003",
                Name = "One",
            });

            // Act

            var video1 = stream.RemoveVideo(new Video {
                Id = "001"
            });
            var video2 = stream.RemoveVideo(new Video {
                Id = "001"
            });
            var video3 = stream.Stream.Count;

            // Assert

            Assert.Equal(1, video1);
            Assert.Equal(0, video2);
        }
        public void CanInsertVideo()
        {
            // Arrange

            var stream = new VideoStream();

            stream.AddVideo(new Video
            {
                Id   = "001",
                Name = "One",
            });

            stream.AddVideo(new Video
            {
                Id   = "002",
                Name = "Two",
            });

            stream.AddVideo(new Video
            {
                Id   = "001",
                Name = "One",
            });

            // Act

            var video1 = stream.Stream[0];
            var video2 = stream.Stream[1];
            var video3 = stream.Stream.Count;

            // Assert

            Assert.Equal("001", video1.Id);
            Assert.Equal("002", video2.Id);
            Assert.Equal(2, video3);
        }
 public static void LoadVideos(VideoStream stream)
 {
     stream.AddVideo(new Video
     {
         Id       = "001",
         Name     = "whatever",
         Category = { "friends", "chill", "sunday", "enthralling" },
         Genre    = { "action", "drama", "police" },
         Actors   = { "brad", "pitt", "johnny", "deep" }
     });
     stream.AddVideo(new Video
     {
         Id       = "002",
         Name     = "whatever2",
         Category = { "friends", "chill", "sunday", "enthralling" },
         Genre    = { "action", "comedy" },
         Actors   = { "brad", "johnny", "deep", "mother" }
     });
     stream.AddVideo(new Video
     {
         Id       = "003",
         Name     = "whatever4",
         Category = { "friends", "sunday", "enthralling" },
         Genre    = { "action", "drama", "police" },
         Actors   = { "brad", "pitt", "johnny", "deep" }
     });
     stream.AddVideo(new Video
     {
         Id       = "004",
         Name     = "whatever",
         Category = { "friends", "chill", "sunday", "enthralling" },
         Genre    = { "action", "drama", "police" },
         Actors   = { "brad", "pitt", "johnny", "deep" }
     });
     stream.AddVideo(new Video
     {
         Id       = "005",
         Name     = "whatever55",
         Category = { "some" },
         Genre    = { "action", "drama", "police" },
         Actors   = { "brad", "pitt", "johnny", "deep" }
     });
     stream.AddVideo(new Video
     {
         Id       = "006",
         Name     = "whatever9",
         Category = { "friends", "chill", "sunday", "enthralling" },
         Genre    = { "blah" },
         Actors   = { "brad", "pitt", "johnny", "deep" }
     });
     stream.AddVideo(new Video
     {
         Id       = "007",
         Name     = "whatever",
         Category = { "friends", "chill", "sunday", "enthralling" },
         Genre    = { "action", "drama", "police" },
         Actors   = { "brad", "pitt", "johnny", "deep" }
     });
     stream.AddVideo(new Video
     {
         Id       = "008",
         Name     = "whatever",
         Category = { "friends", "chill", "sunday", "enthralling" },
         Genre    = { "action", "drama", "police" },
         Actors   = { "brad", "pitt", "johnny", "deep" }
     });
 }
 public static void LoadVideos(VideoStream stream)
 {
     stream.AddVideo(new Video
     {
         Id       = "001",
         Name     = "The Shawshank Redemption",
         Category = { "classic", "top 10 mivies", "sunday", "family" },
         Genre    = { "crime", "drama", "police", },
         Actors   = { "tim robbins", "morgan freeman", "bob gunton" }
     });
     stream.AddVideo(new Video
     {
         Id       = "002",
         Name     = "Forrest Gump",
         Category = { "classic", "top 10 mivies", "sunday", "family" },
         Genre    = { "drama", "romance", "adventure" },
         Actors   = { "tom hanks", "robin wright", "gary sinise" }
     });
     stream.AddVideo(new Video
     {
         Id       = "003",
         Name     = "Fight Club",
         Category = { "friends", "enthralling" },
         Genre    = { "action", "mistery", "thriller" },
         Actors   = { "brad pitt", "edward norton", "meat loaf" }
     });
     stream.AddVideo(new Video
     {
         Id       = "004",
         Name     = "Pulp Fiction",
         Category = { "classic", "top 10 mivies", "sunday", "family" },
         Genre    = { "crime", "drama", "police" },
         Actors   = { "john travolta", "uma thurman", "samuel l. jackson" }
     });
     stream.AddVideo(new Video
     {
         Id       = "005",
         Name     = "Inglorious Bastards",
         Category = { "mature", "friends", "pillow fight night", "top 10 mivies" },
         Genre    = { "adventure", "war", "drama" },
         Actors   = { "brad pitt", "diane kruger", "eli roth", "meat loaf" }
     });
     stream.AddVideo(new Video
     {
         Id       = "006",
         Name     = "The Wolf of Wallstreet",
         Category = { "amazing", "progressive", "inspired from real life events", "friends" },
         Genre    = { "biography", "comedy", "crime" },
         Actors   = { "leonard di caprio", "jonah hill", "margot robbie" }
     });
     stream.AddVideo(new Video
     {
         Id       = "007",
         Name     = "Catch me of you can",
         Category = { "amazing", "progressive", "inspired from real life events", "friends" },
         Genre    = { "biography", "comedy", "crime" },
         Actors   = { "leonard di caprio", "jonah hill", "margot robbie" }
     });
     stream.AddVideo(new Video
     {
         Id       = "008",
         Name     = "Saw",
         Category = { "night", "scary", "home alone" },
         Genre    = { "horror" },
         Actors   = { "carry elwes", "danny glover", "leigh whannell" }
     });
 }