Exemple #1
0
        public void TestJobToString()
        {
            using (var reader = EntityDataMock.mockJobReader())
            {
                string correctString = $"{reader["title"]}";

                Job job = new Job(reader);
                Assert.AreEqual(job.ToString(), correctString);
            }
        }
Exemple #2
0
 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);
     }
 }
Exemple #3
0
 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);
     }
 }
Exemple #4
0
        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);
            }
        }