public void TestJobToString() { using (var reader = EntityDataMock.mockJobReader()) { string correctString = $"{reader["title"]}"; Job job = new Job(reader); Assert.AreEqual(job.ToString(), correctString); } }
public void TestToInsertCompanySuccess() { using (var reader = EntityDataMock.mockJobReader()) { Job job = new Job(reader); job.clientCompany = EntityObjectMock.createCompany(); job.assignedEmployee = EntityObjectMock.createEmployee(); string correctString = $"(title, company_id, description, " + $"assigned_employee, predicted_time, predicted_cost) " + $"VALUES ('{reader["title"]}', {job.clientCompany.id}," + $" '{reader["description"]}', {job.assignedEmployee.id}," + $" {reader["predicted_time"]}, {reader["predicted_cost"]});"; Assert.AreEqual(job.ToInsert(), correctString); } }
public void TestToUpdateCompanySuccess() { using (var reader = EntityDataMock.mockJobReader()) { Job job = new Job(reader); job.clientCompany = EntityObjectMock.createCompany(); job.assignedEmployee = EntityObjectMock.createEmployee(); string correctString = $"title='{reader["title"]}', " + $"description='{reader["description"]}', " + $"company_id={job.clientCompany.id}, " + $"assigned_employee={job.assignedEmployee.id}, " + $"predicted_time={reader["predicted_time"]}, " + $"predicted_cost={reader["predicted_cost"]}"; Assert.AreEqual(job.ToUpdate(), correctString); } }
public void TestToInsertFailure() { using (var reader = EntityDataMock.mockJobReader()) { string correctString = $"{reader["title"]}"; Job job = new Job(reader); try { job.ToInsert(); } catch (Exception error) { Assert.AreEqual(true, true); return; } Assert.AreEqual(false, true); } }