public void CallDAOComprehensiveTestsReturnTrue() { CallDAO dao = new CallDAO(); Call call = new Call(); call.DateOpened = DateTime.Now; call.DateClosed = null; call.OpenStatus = true; call.EmployeeId = new MongoDB.Bson.ObjectId("56464e723dd4df30e88b8b8c"); //Bigshot call.TechId = new MongoDB.Bson.ObjectId("56464e723dd4df30e88b8b92"); //Burner call.ProblemId = new MongoDB.Bson.ObjectId("56464e723dd4df30e88b8b99"); //memory call.Notes = "Bigshot has bad RAM, Burner to fix it"; string newId = dao.Create(call); this.testContextInstance.WriteLine("New Call Id == " + newId); call = dao.GetByID(newId); this.testContextInstance.WriteLine("Call retrieved"); call.Notes = call.Notes + "\nOrdered new RAM"; if (dao.Update(call) == 1) { this.testContextInstance.WriteLine("Call was updated"); } else { Trace.WriteLine("Call was not updated"); } if (dao.Delete(newId)) { this.testContextInstance.WriteLine("Call was deleted "); } else { this.testContextInstance.WriteLine("Call was not deleted "); } call = dao.GetByID(newId); Assert.IsNull(call); }
// //find employee with surnme from dal // public void GetByID(string id) { try { Call call = _dao.GetByID(id); Id = call._id.ToString(); EmployeeId = call.EmployeeId.ToString(); ProblemId = call.ProblemId.ToString(); TechId = call.TechId.ToString(); DateOpened = call.DateOpened; DateClosed = call.DateClosed; OpenStatus = call.OpenStatus; Notes = call.Notes; Entity64 = Convert.ToBase64String(Serializer(call)); } catch (Exception ex) { ErrorRoutine(ex, "EmployeeViewModel", "GetByID"); } }