Exemple #1
0
        public async void TestLogicCreateTicket()
        {
            string   userID      = "USERID123";
            string   description = "report description";
            DateTime time        = DateTime.Now;

            using (var context = new Cinephiliacs_AdmintoolsContext(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();
                AdminRepository repo  = new AdminRepository(context);
                ReportingLogic  logic = new ReportingLogic(repo, new Mapper());
                ReportModel     model = new ReportModel()
                {
                    ReportEntityType  = "Review",
                    ReportEnitityId   = userID,
                    ReportDescription = description,
                };
                bool success = await logic.CreateReportTicket(model);
            }

            using (var context1 = new Cinephiliacs_AdmintoolsContext(options))
            {
                context1.Database.EnsureCreated();
                var tickets = context1.Tickets.ToList();
                tickets.ForEach(t =>
                {
                    System.Console.WriteLine(t.ItemId);
                    System.Console.WriteLine(t.AffectedService);
                    System.Console.WriteLine(t.Descript);
                    System.Console.WriteLine(t.TimeSubmitted);
                    System.Console.WriteLine(t.TicketId);
                });
                var ticket = context1.Tickets.Where(t => t.ItemId == userID && t.Descript == description).FirstOrDefault();
                Assert.NotNull(ticket);
            }
        }
Exemple #2
0
 public ReportsController(ReportingLogic _reportLogic)
 {
     this._reportLogic = _reportLogic;
 }