예제 #1
0
        public void InsertComment()
        {
            Console.WriteLine("TestAddToMyList initiated");
            Console.WriteLine("---------------------------");

            //Arrange
            SessionDB sDB              = new SessionDB();
            int       person_id        = 1;
            int       user_id          = 1;
            int       entertainment_id = 1;
            string    message          = "Awww YEAH!";

            //Act
            Session sessiondb       = sDB.FindSession(person_id);
            EntertainmentService es = new EntertainmentService();
            Session session         = new Session
            {
                Id         = sessiondb.Id,
                Session_id = sessiondb.Session_id
            };

            User user = new User
            {
                Id      = user_id,
                Session = session
            };

            Comment comment = new Comment
            {
                Entertainment_Id = entertainment_id,
                Message          = message,
                User             = user
            };

            es.InsertComment(comment);
            Movie          movie    = es.GetMovieById(entertainment_id);
            List <Comment> comments = movie.Comments;

            //Assert
            Assert.AreEqual(3, comments.Count);

            Console.WriteLine("TestAddToMyList complete");
            Console.WriteLine("--------------------------");
            Console.ReadLine();
        }
예제 #2
0
        public void FindMovieById()
        {
            Console.WriteLine("TestAddToMyList initiated");
            Console.WriteLine("---------------------------");

            //Arrange
            EntertainmentService es = new EntertainmentService();
            int movie_ID            = 1;

            //Act
            Movie movie = es.GetMovieById(movie_ID);

            //Assert
            Assert.AreEqual("Iron Man", movie.Title);

            Console.WriteLine("TestAddToMyList complete");
            Console.WriteLine("--------------------------");
            Console.ReadLine();
        }
예제 #3
0
        public void FindAllEntertainments()
        {
            Console.WriteLine("TestAddToMyList initiated");
            Console.WriteLine("---------------------------");

            //Arrange
            EntertainmentService es             = new EntertainmentService();
            List <Entertainment> entertainments = new List <Entertainment>();

            //Act
            entertainments = es.FindAllEntertainments();

            //Assert
            Assert.AreEqual(4, entertainments.Count);

            Console.WriteLine("TestAddToMyList complete");
            Console.WriteLine("--------------------------");
            Console.ReadLine();
        }
예제 #4
0
 /// <summary>
 /// Constructor for MovieController
 /// </summary>
 public MovieController()
 {
     eS = new EntertainmentService();
 }
예제 #5
0
 //private Entertainment entertainment;
 public HomeController()
 {
     eS = new EntertainmentService();
     //entertainment = new Entertainment();
 }
예제 #6
0
 /// <summary>
 /// Constructor for Homecontroller
 /// </summary>
 public HomeController()
 {
     eS  = new EntertainmentService();
     lis = new LogInService();
 }
예제 #7
0
        static void Main(string[] args)
        {
            EntertainmentDB           edb = new EntertainmentDB();
            EntertainmentService      es  = new EntertainmentService();
            EntertainmentAdminService eas = new EntertainmentAdminService();
            Service1  ss  = new Service1();
            SessionDB sDB = new SessionDB();

            //List<Entertainment> temp = edb.GetAllEntertainments();
            //foreach (Entertainment ent in temp)
            //{
            //    Console.WriteLine(ent.Id);
            //    Console.WriteLine(ent.Title);
            //    Console.WriteLine(ent.ReleaseDate);
            //}

            //edb.GetPersonalEntertainments(1);

            List <Entertainment> temp2 = es.FindAllEntertainments();

            foreach (Entertainment ent2 in temp2)
            {
                Console.WriteLine(ent2.Id);
                Console.WriteLine(ent2.Title);
                Console.WriteLine(ent2.ReleaseDate);
            }

            //List<Genre> genres = edb.GetAllGenres();
            //foreach (Genre genre in genres)
            //{
            //    Console.WriteLine(genre.Id);
            //    Console.WriteLine(genre.Name);
            //}

            //List<Country> countries = edb.GetAllCountries();
            //foreach (Country country in countries)
            //{
            //    Console.WriteLine(country.Id);
            //    Console.WriteLine(country.Name);
            //}

            //Movie movie = new Movie
            //{
            //    Title = "Iron Man 4",
            //    Genre = edb.FindGenreByName("Action"),
            //    Country = edb.FindCountryByName("USA"),
            //    Language = edb.FindLanguageByName("English"),
            //    ReleaseDate = DateTime.Now,
            //    StoryLine = "Something Explode",
            //    FilmingLocation = "New York",
            //    Information = "nice",
            //    //IsMovie = true
            //};
            //eas.StartInsertMovieTransaction(movie);


            //Movie testmovie = es.GetMovieById(1);
            //Console.WriteLine(testmovie.Title);

            Movie findMovie = es.GetMovieById(1);

            Console.WriteLine(findMovie.Title);
            Console.WriteLine(findMovie.Country.Name);
            Console.WriteLine(findMovie.Language.Name);
            Console.WriteLine(findMovie.Genre.Name);

            //long ticks = DateTime.Now.Ticks;
            //byte[] bytes = BitConverter.GetBytes(ticks);
            //string id = Convert.ToBase64String(bytes).Replace('+', '_').Replace('/', '-').TrimEnd('=');
            //Console.WriteLine(id);

            User user = new User
            {
                Password = "******",
                UserName = "******"
            };

            User u = ss.LoginConfirmation(user);

            Console.WriteLine(u.Id);
            Console.WriteLine(u.Session.Session_id);



            Session sessiondb = sDB.FindSession(1);
            Session session   = new Session
            {
                Id         = sessiondb.Id,
                Session_id = sessiondb.Session_id
            };

            User user1 = new User
            {
                Id      = 1,
                Session = session
            };

            Comment comment = new Comment
            {
                Entertainment_Id = 1,
                Message          = "Awwww YEAH!",
                User             = user1
            };

            es.InsertComment(comment);
        }