Exemplo n.º 1
0
        public IActionResult AddMovieToRoom()
        {
            MovieToRoomViewModel viewModel = new();

            viewModel.Movies = new SelectList(_sqlMovieService.ListMovies().Select(movie => movie.Name));
            viewModel.Rooms  = new SelectList(_sqlRoomService.ListRooms().Select(room => room.Name));

            return(View(viewModel));
        }
Exemplo n.º 2
0
        public void ListRooms_ShouldWork()
        {
            //Arrange
            int roomExpextedCount = 2;

            Room room = new()
            {
                Name      = "wwwe",
                Cinema    = new Cinema(),
                Seats     = new List <Seat>(),
                CinemaId  = 1,
                MovieRoom = new List <MovieRoom>()
            };

            Room room2 = new()
            {
                Name      = "wwweqewe",
                Cinema    = new Cinema(),
                Seats     = new List <Seat>(),
                CinemaId  = 13,
                MovieRoom = new List <MovieRoom>()
            };

            //Act
            _dbContext.Room.Add(room);
            _dbContext.Room.Add(room2);

            _dbContext.SaveChanges();

            //Assert
            List <Room> rooms = _sqlRoomService.ListRooms();

            Assert.IsNotNull(rooms);
            Assert.AreEqual(roomExpextedCount, rooms.Count);
        }

        [TestMethod]