public MovieController(IConfiguration config) { _config = config; _moviesConnectionString = config["ConnectionStrings:db1"]; _postersFilePath = config["FilePaths:posters"]; _movieManagement = new MovieManagement(_moviesConnectionString, _postersFilePath); }
public async Task <IActionResult> AddMovieManagement([FromBody] MovieManagement moviemgmt) { try { if (string.IsNullOrWhiteSpace(moviemgmt.DirectedBy)) { return(BadRequest("Please enter Director Name")); } else if (string.IsNullOrWhiteSpace(moviemgmt.Producer)) { return(BadRequest("Please enter Email")); } else if (string.IsNullOrWhiteSpace(moviemgmt.Production)) { return(BadRequest("Please enter Address")); } await _movieservices.RegisterAsync(moviemgmt); return(Ok("Movie has been added successfully")); } catch (Exception ex) { return(BadRequest(ex.ToString())); } }
//creating or mocking dummy object public ExceptionalTest() { _movieManagement = new MovieManagement { DirectedBy = "Arvind", Producer = "Soni Movies", Production = "Abc Corp", ReleasedDate = DateTime.Now.AddDays(5), }; _multiplex = new MultiplexManagement { Name = "PVR", City = "Chandigarh", State = "UT" }; _allotMovie = new AllotMovie { MovieName = "Dil Bechara", MultiplexName = "PVR", City = "Chandigarh", State = "UT" }; _mockCollection = new Mock <IMongoCollection <MovieManagement> >(); _mockCollection.Object.InsertOne(_movieManagement); _multiplexCollection = new Mock <IMongoCollection <MultiplexManagement> >(); _multiplexCollection.Object.InsertOne(_multiplex); _mockContext = new Mock <IMongoDBContext>(); _mockOptions = new Mock <IOptions <Mongosettings> >(); }
private void btnMovieManagement_Click(object sender, EventArgs e) { Control[] controls = Controls.Find("MovieManagement", true); if (controls.Length < 1) { MovieManagement movieManagement = new MovieManagement(m_Model, presenter); ShiftUserControlDisplay(movieManagement, GridViewOptionEnum.Movies); } }
//creating or mocking dummy object public BoundaryTest() { _movieManagement = new MovieManagement { DirectedBy = "Arvind", Producer = "Soni Movies", Production = "Abc Corp", ReleasedDate = DateTime.Now.AddDays(5), }; _mockCollection = new Mock <IMongoCollection <MovieManagement> >(); _mockCollection.Object.InsertOne(_movieManagement); _mockContext = new Mock <IMongoDBContext>(); //MongoSettings initialization _mockOptions = new Mock <IOptions <Mongosettings> >(); _list = new List <MovieManagement>(); _list.Add(_movieManagement); }
//creating or mocking dummy object public BusinessLogicTests() { _movieManagement = new MovieManagement { DirectedBy = "Arvind", Producer = "Soni Movies", Production = "Abc Corp", ReleasedDate = DateTime.Now.AddDays(5), }; _multiplexManagement = new MultiplexManagement { Name = "PVR", City = "Chandigarh", State = "UT" }; _allotMovie = new AllotMovie { MovieName = "Dil Bechara", MultiplexName = "PVR", City = "Chandigarh", State = "UT" }; _mockCollection = new Mock <IMongoCollection <MovieManagement> >(); _mockCollection.Object.InsertOne(_movieManagement); _multiplexmockCollection = new Mock <IMongoCollection <MultiplexManagement> >(); _multiplexmockCollection.Object.InsertOne(_multiplexManagement); _allotmockCollection = new Mock <IMongoCollection <AllotMovie> >(); _allotmockCollection.Object.InsertOne(_allotMovie); _list = new List <MovieManagement>(); _list.Add(_movieManagement); _multiplexlist = new List <MultiplexManagement>(); _multiplexlist.Add(_multiplexManagement); _mockContext = new Mock <IMongoDBContext>(); //MongoSettings initialization _mockOptions = new Mock <IOptions <Mongosettings> >(); _list = new List <MovieManagement>(); _list.Add(_movieManagement); }
public async Task <MovieManagement> AddMovieManagement(MovieManagement movieManagement) { try { if (movieManagement == null) { throw new ArgumentNullException(typeof(MovieManagement).Name + " object is null"); } _moviedbCollection = _mongoContext.GetCollection <MovieManagement>(typeof(MovieManagement).Name); await _moviedbCollection.InsertOneAsync(movieManagement); return(movieManagement); } catch (Exception ex) { throw (ex); } }
public async void CreateNewMovie_Null_Failure() { // Arrange _movieManagement = null; var res = true; //Act var bookRepo = new MovieServices(_mockContext.Object); // Assert var create = bookRepo.RegisterAsync(_movieManagement); await Assert.ThrowsAsync <ArgumentNullException>(() => create); if (create.IsCompletedSuccessfully) { res = false; } //writing tset boolean output in text file, that is present in project directory File.AppendAllText("../../../../output_exception_revised.txt", "CreateNewBuyer_Null_Failure=" + res + "\n"); }
//logout movie public Task <bool> LogOut(MovieManagement movieManagement) { //write code here throw new NotImplementedException(); }