public void GenerateEmailBodyForInvoicingTeamTest() { DateTime dt = new DateTime(2011, 02, 14); TimeSpan timeSpan = new TimeSpan(10, 11, 59); CS_Country country = new CS_Country() { ID = 1, Active = true, Name = "USA" }; CS_State state = new CS_State() { ID = 1, Active = true, Name = "Texas" }; CS_City city = new CS_City() { ID = 1, Active = true, Name = "Dalton" }; CS_LocationInfo locationInfo = new CS_LocationInfo() { Active = true, CountryID = 1, StateID = 1, CityID = 1, CS_Country = country, CS_State = state, CS_City = city }; CS_Frequency frequency = new CS_Frequency() { Active = true, ID = 1, Description = "D" }; CS_JobDescription csJobDescription = new CS_JobDescription() { Active = true, NumberEmpties = 1, NumberLoads = 2, NumberEngines = 1 }; CS_Division division = new CS_Division() { ID = 241, Active = true, Name = "005", Description = "White River, Ontario" }; CS_JobDivision jobdivision = new CS_JobDivision() { Active = true, JobID = 243, DivisionID = 241, CS_Division = division }; CS_Employee employee = new CS_Employee() { ID = 1, Active = true, Name = "Dcecilia", FirstName = "Test", DivisionID = 241 }; CS_Reserve reserve = new CS_Reserve() { Active = true, JobID = 243, Type = 2, CS_Employee = employee, DivisionID = 241 }; EntityCollection<CS_JobDivision> JobDivision = new EntityCollection<CS_JobDivision>(); JobDivision.Add(jobdivision); CS_ScopeOfWork csScopeOfWork = new CS_ScopeOfWork() { Active = true, ScopeOfWork = "xxcxcxc", JobId = 243 }; EntityCollection<CS_Reserve> csReserves = new EntityCollection<CS_Reserve>(); csReserves.Add(reserve); EntityCollection<CS_ScopeOfWork> scopeOfWorks = new EntityCollection<CS_ScopeOfWork>(); scopeOfWorks.Add(csScopeOfWork); //Arrange FakeObjectSet<CS_Job> fakeJobObject = new FakeObjectSet<CS_Job>(); fakeJobObject.AddObject ( new CS_Job() { ID = 243, Active = true, CreatedBy = "rbrandao", CreationDate = DateTime.Now, ModificationDate = DateTime.Now, ModifiedBy = "Load", //Internal_Tracking = "000000025INT", Number = "000243", CS_ScopeOfWork = scopeOfWorks, CS_JobDivision = JobDivision, CS_Reserve = csReserves, CS_CustomerInfo = new CS_CustomerInfo() { Active = true, CS_Customer = new CS_Customer() { Active = true, Name = "American Test" }, CS_Division = division, CS_Contact1 = new CS_Contact() { ID = 1, Active = true, Name = "danilo", LastName = "cecilia", }, CS_Contact3 = new CS_Contact() { ID = 1, Active = true, Name = "danilo", LastName = "cecilia", }, //IsCustomer = true, InitialCustomerContactId = 1, BillToContactId = 1 }, CS_JobInfo = new CS_JobInfo() { Active = true, InterimBill = true, CS_Employee = employee, EmployeeID = employee.ID, CS_Frequency = frequency, FrequencyID = 1, CS_JobAction = new CS_JobAction() { Active = true, Description = "Environmental Work, General - Undefined Scope of Work" }, CS_JobType = new CS_JobType() { Active = true, Description = "A" }, InitialCallDate = dt, InitialCallTime = timeSpan, CS_PriceType = new CS_PriceType() { Active = true, Acronym = "P", Description = "description test" }, CS_JobCategory = new CS_JobCategory() { Active = true, Description = "B" }, CS_Job_JobStatus = new EntityCollection<CS_Job_JobStatus>() { new CS_Job_JobStatus() { Active = true, JobStatusId = (int)Globals.JobRecord.JobStatus.Active, JobStartDate = new DateTime(2011,02,14), JobCloseDate = new DateTime(2011,02,14) } } }, CS_LocationInfo = locationInfo, CS_JobDescription = csJobDescription } ); //Act Mock<IUnitOfWork> mockUnitOfWork = new Mock<IUnitOfWork>(); mockUnitOfWork.Setup(w => w.CreateObjectSet<CS_Job>()).Returns(fakeJobObject); JobModel jobModel = new JobModel(mockUnitOfWork.Object); string body = jobModel.GenerateEmailBodyForInvoicingTeam(243); StringBuilder sb = new StringBuilder(); sb.Append("<div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Job#:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" PA000243"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Customer:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" American Test"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Initial Customer Contact:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" danilo"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Bill to:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" cecilia, danilo"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Initial Call date:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" 02/14/2011"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Initial Call time:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" 10:11:59"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Price Type:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" description test"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Job Action:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" Environmental Work, General - Undefined Scope of Work"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Job Category:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" B"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Job Type:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" A"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Division:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" 005"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Interim Bill:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" Yes"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Requested By:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" Dcecilia, Test"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Frequency:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" D"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Country:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" USA"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("State:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" Texas"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("City:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" Dalton"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Number Engines:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" 1"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Number Loads:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" 2"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Number Empties:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" 1"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Scope Of Work:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append("xxcxcxc"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Job start date:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" 02/14/2011 00:00:00"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div style='width: 100%; display: inline-block;'>"); sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>"); sb.Append("Job end date:"); sb.Append("</b></div>"); sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>"); sb.Append(" 02/14/2011 00:00:00"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("</div>"); //Assert Assert.AreEqual(sb.ToString(), body); }
public void Initialize() { // Step 1 - Clear Tables JobInfoDao.Singleton.ClearAll(); ResourceDao.Singleton.ClearAll(); EmployeeDao.Singleton.ClearAll(); // Step 2 - Adding controlled data country = CountryDao.Singleton.Add( new CS_Country() { Active = true, Name = "USA", CreatedBy = "Load", CreationDate = DateTime.Now, ModifiedBy = "Load", ModificationDate = DateTime.Now }); state = StateDao.Singleton.Add( new CS_State() { Active = true, Acronym = "TX", Name = "Texas", CountryID = country.ID, CreatedBy = "Load", CreationDate = DateTime.Now, ModifiedBy = "Load", ModificationDate = DateTime.Now }); division = DivisionDao.Singleton.Add( new CS_Division() { Active = true, CountryID = country.ID, Description = "DIV1", StateID = state.ID, Name = "001", CreatedBy = "Load", CreationDate = DateTime.Now, ModifiedBy = "Load", ModificationDate = DateTime.Now }); employee1 = EmployeeDao.Singleton.Add( new CS_Employee() { Active = true, FirstName = "a", Name = "b", DivisionID = division.ID, BusinessCardTitle = "Laborer", CreatedBy = "Load", CreationDate = DateTime.Now, ModifiedBy = "Load", ModificationDate = DateTime.Now }); employee2 = EmployeeDao.Singleton.Add( new CS_Employee() { Active = true, FirstName = "c", Name = "d", DivisionID = division.ID, BusinessCardTitle = "Regional Vice President", CreatedBy = "Load", CreationDate = DateTime.Now, ModifiedBy = "Load", ModificationDate = DateTime.Now }); jobStatus = JobStatusDao.Singleton.Add( new CS_JobStatus() { Active = true, Description = "Active", CreatedBy = "Load", CreationDate = DateTime.Now, ModifiedBy = "Load", ModificationDate = DateTime.Now }); priceType = PriceTypeDao.Singleton.Add( new CS_PriceType() { Active = true, Acronym = "X", Description = "X", CreatedBy = "Load", CreationDate = DateTime.Now, ModifiedBy = "Load", ModificationDate = DateTime.Now }); jobCategory = JobCategoryDao.Singleton.Add( new CS_JobCategory() { Active = true, Description = "X", CreatedBy = "Load", CreationDate = DateTime.Now, ModifiedBy = "Load", ModificationDate = DateTime.Now }); jobType = JobTypeDao.Singleton.Add( new CS_JobType() { Active = true, Description = "X", CreatedBy = "Load", CreationDate = DateTime.Now, ModifiedBy = "Load", ModificationDate = DateTime.Now }); jobAction = JobActionDao.Singleton.Add( new CS_JobAction() { Active = true, Description = "X", CreatedBy = "Load", CreationDate = DateTime.Now, ModifiedBy = "Load", ModificationDate = DateTime.Now }); job = JobDao.Singleton.Add( new CS_Job() { Active = true, Number = "000001", CreatedBy = "Load", CreationDate = DateTime.Now, ModifiedBy = "Load", ModificationDate = DateTime.Now }); jobInfo = JobInfoDao.Singleton.Add( new CS_JobInfo() { Active = true, JobID = job.ID, JobStatusID = jobStatus.ID, PriceTypeID = priceType.ID, JobCategoryID = jobCategory.ID, JobTypeID = jobType.ID, JobActionID = jobAction.ID, InitialCallDate = DateTime.Now, InitialCallTime = new TimeSpan(0, 1, 10, 0, 0), InterimBill = false, ProjectManager = employee2.ID, EmployeeID = employee2.ID, CreatedBy = "Load", CreationDate = DateTime.Now, ModifiedBy = "Load", ModificationDate = DateTime.Now }); resource = ResourceDao.Singleton.Add( new CS_Resource() { Active = true, EmployeeID = employee1.ID, JobID = job.ID, CreatedBy = "Load", CreationDate = DateTime.Now, ModifiedBy = "Load", ModificationDate = DateTime.Now }); }