static void Main(string[] args) { RentalContext ctx = new RentalContext(); RentRepository rentRepo = new RentRepository(ctx); VideoGameRepository gameRepo = new VideoGameRepository(ctx); PersonRepository personRepo = new PersonRepository(ctx); RentLogic rentLogic = new RentLogic(rentRepo); VideoGameLogic gameLogic = new VideoGameLogic(gameRepo); PersonLogic personLogic = new PersonLogic(personRepo); Console.WriteLine(">List all rents"); rentLogic.GetAllRentals().ToList().ForEach(x => Console.WriteLine(x.AllData)); Console.WriteLine("\n\n##################################################\n"); Console.WriteLine("\n\n>List all games"); gameLogic.GetAllGames().ToList().ForEach(x => Console.WriteLine(x.AllData)); Console.WriteLine("\n\n##################################################\n"); Console.WriteLine("\n\n>List all people"); personLogic.GetAllPeople().ToList().ForEach(x => Console.WriteLine(x.AllData)); //################################################## Console.WriteLine(rentLogic.MostFine()); Console.WriteLine(rentLogic.MostRentedGame()); Console.WriteLine(rentLogic.MostRentsByPerson()); }
public void CreateRentTest(int gameId, int personId, int rentYear, int rentMonth, int rentDay, int returnYear, int returnMonth, int returnDay) { DateTime rentDate = new DateTime(rentYear, rentMonth, rentDay); DateTime returnDate = new DateTime(returnYear, returnMonth, returnDay); Rental r = new Rental() { GameRef = gameId, PersonRef = personId, RentDate = rentDate, ReturnDate = returnDate }; rentLogic.NewRent(r); var all = rentLogic.GetAllRentals(); int id = 0; foreach (var item in all) { if (item.RentDate == rentDate) { id = item.Id; } } Assert.That(rentLogic.GetRentById(id).Id, Is.EqualTo(id)); }
public IActionResult GetRentals() { return(View(rentLogic.GetAllRentals())); }