public void PostAccidentCreationAndDeletionTest() { ///Initialization var db = new IncidentsDataContext(); var incidentType = db.IncidentTypes.FirstOrDefault(); var date = new DateTime(2019, 12, 1); var incident = new Incident() { Description = "Test description", Person = "Test Person", IncidentDate = date, IncidentTypeId = incidentType.Id }; var incidentsApiController = new IncidentsController(); ///Execution var result = incidentsApiController.PostIncident(incident); ///Assertion Assert.IsNotNull(result); int accidentId = incident.Id; Assert.IsTrue(accidentId > 0); ///Accident Car //var incidentAffectedRecord = db.Incidents.FirstOrDefault(c => c.Id == incidentId); //Assert.IsNotNull(accidentCar); //Assert.AreEqual(accidentCar.CarId, car.Id); //Assert.IsNotNull(accidentCar.CreationDate); //Assert.AreEqual(accidentCar.CreationDate.Value.Date, DateTime.Now.Date); /////Report //var report = db.Reports.FirstOrDefault(c => c.AccidentId == accidentId); //Assert.IsNotNull(report); }
public void PostIncident() { IncidentsController api = new IncidentsController(); var response = api.PostIncident(new Model.Models.Incident() { Kind = "TEST", HappenedAt = DateTime.Now, IsArchive = false, LocationId = "TEST" }); Assert.IsTrue(response); }