Example #1
0
        public ResponseMessage Create(Report entity)
        {
            ResponseMessage response = new ResponseMessage();

            _repository.Create(entity);

            response.CreatedId = _repository.GetLatestReportId();

            return(response);
        }
Example #2
0
 public async Task <IActionResult> CreateReport(long idCompany, [FromBody] ReportRequest request)
 {
     try
     {
         return(new OkObjectResult(await _reportRepository.Create(request)));
     }
     catch (Exception e)
     {
         return(new ObjectResult(new { error = e.Message })
         {
             StatusCode = 500
         });
     }
 }
Example #3
0
        public void ReportRepository()
        {
            Mock <IDbSetFactory>   factory = new Mock <IDbSetFactory>();
            Mock <DbSet <Report> > dbSet   = new Mock <DbSet <Report> >();

            factory.Setup(m => m.CreateDbSet <Report>()).Returns(dbSet.Object);

            ReportRepository repo = new ReportRepository(factory.Object);

            var Report = new Report();

            var sequence = new MockSequence();

            dbSet.InSequence(sequence).Setup(e => e.Add(Report));
            dbSet.InSequence(sequence).Setup(e => e.Find(Report.Id));
            dbSet.InSequence(sequence).Setup(e => e.Find(Report.Id));
            dbSet.InSequence(sequence).Setup(e => e.Find(Report.Id));
            repo.Create(Report);
            repo.Get(Report.Id);
            repo.Update(Report);
            repo.Delete(Report.Id);
        }
        public void ReportRepository()
        {
            Mock<IDbSetFactory> factory = new Mock<IDbSetFactory>();
            Mock<DbSet<Report>> dbSet = new Mock<DbSet<Report>>();

            factory.Setup(m => m.CreateDbSet<Report>()).Returns(dbSet.Object);

            ReportRepository repo = new ReportRepository(factory.Object);

            var Report = new Report();

            var sequence = new MockSequence();
            dbSet.InSequence(sequence).Setup(e => e.Add(Report));
            dbSet.InSequence(sequence).Setup(e => e.Find(Report.Id));
            dbSet.InSequence(sequence).Setup(e => e.Find(Report.Id));
            dbSet.InSequence(sequence).Setup(e => e.Find(Report.Id));
            repo.Create(Report);
            repo.Get(Report.Id);
            repo.Update(Report);
            repo.Delete(Report.Id);
        }
Example #5
0
 public void CreateReport(Report report)
 {
     reportRepo.Create(report);
 }