public void StoredProcedureTest02() { var operatorIDString = "08921908-EBA0-4A20-B2C7-703A05569338"; var startDateString = "02 jul 2018"; var endDateString = "03 jul 2018"; DateTime.TryParse(startDateString, out var startDate); DateTime.TryParse(endDateString, out var endDate); Guid.TryParse(operatorIDString, out var operatorId); TopDesk577Entities db = new TopDesk577Entities(); var results = db.UTVF_IncidentsMovedToOperator(operatorId, startDate, endDate); Assert.IsNotNull(results, "Stored Proceducre returned no results"); Assert.IsTrue(results.Any(), "Doesn't have any records"); var incident = results.FirstOrDefault(); // Incident number. Assert.IsNotNull(incident, "Incident is null"); Assert.IsFalse(string.IsNullOrEmpty(incident.Incident), "Incident text is empty"); incident incidentItem = db.incidents.Where(x => x.naam == incident.Incident).FirstOrDefault(); Assert.IsNotNull(incidentItem, "Stored Proceducre returned no results"); Assert.IsTrue(incidentItem.naam == incident.Incident, "Incident Records don't match"); var results2 = db.UTVF_IncidentOperatorMovements(incident.Incident); Assert.IsNotNull(results2, "Stored Proceducre returned no results"); Assert.IsTrue(results2.Any(), "Doesn't have any records"); var incident2 = results2.FirstOrDefault(); Assert.IsNotNull(incident.Incident, "Incident is null"); Assert.IsFalse(string.IsNullOrEmpty(incident.Incident), "Incident text is empty"); var currentDate = new DateTime(); results2.ToList().ForEach(item => { Assert.IsTrue(item.Move_Date != null, "Move date is null"); Assert.IsTrue(item.Move_Date > currentDate, "Move Date is not is sequencial order :" + currentDate.ToString() + " " + item.Move_Date.ToString() + " Row " + item.RowNumber); currentDate = (DateTime)item.Move_Date; }); JSON_FileExport.WriteFile("StoredProcedureTest02", results2, results2.Count(), "USP_Functions"); }
public void Call_SQL_UTVF_IncidentsMovedToOperator() { var operatorIDString = "08921908-EBA0-4A20-B2C7-703A05569338"; var startDateString = "02 jul 2018"; var endDateString = "03 jul 2018"; DateTime.TryParse(startDateString, out var startDate); DateTime.TryParse(endDateString, out var endDate); Guid.TryParse(operatorIDString, out var operatorId); var db = new TopDesk577Entities(); var results = db.UTVF_IncidentsMovedToOperator(operatorId, startDate, endDate); Assert.IsNotNull(results, "Stored Proceducre returned no results"); Assert.IsTrue(results.Any(), "Doesn't have any records"); var incident = results.FirstOrDefault(); Assert.IsNotNull(incident, "Incident is null"); Assert.IsFalse(string.IsNullOrEmpty(incident.Incident), "Incident text is empty"); }