Ejemplo n.º 1
0
        public void GenerateEmailSubjectEstimationTeam()
        {
            //Arrange
            FakeObjectSet<CS_Job> fakeJobObject = new FakeObjectSet<CS_Job>();
            fakeJobObject.AddObject(
                new CS_Job
                {
                    Active = true,
                    ID = 243,
                    Number = "000123",
                    CS_CustomerInfo = new CS_CustomerInfo
                    {
                        Active = true,
                        CS_Customer = new CS_Customer()
                        {
                            Active = true,
                            Name = "Customer Test"
                        }
                    },
                    CS_JobInfo = new CS_JobInfo
                    {
                        CS_JobType = new CS_JobType() { ID = 1, Description = "A", Active = true },
                        CS_PriceType = new CS_PriceType() { ID = 1, Acronym = "P", Active = true },
                        CS_Job_JobStatus = new EntityCollection<CS_Job_JobStatus>()
                        {
                            new CS_Job_JobStatus { JobStatusId = 1, JobID = 243, Active = true }
                        }
                    }
                }
                );

            //Act
            Mock<IUnitOfWork> mockUnitOfWork = new Mock<IUnitOfWork>();
            mockUnitOfWork.Setup(w => w.CreateObjectSet<CS_Job>()).Returns(fakeJobObject);

            JobModel jobModel = new JobModel(mockUnitOfWork.Object);

            string subject = jobModel.GenerateEmailSubjectEstimationTeam(243);

            string expected = "PA000123, Proposal Number, Customer Test";

            //Assert
            Assert.AreEqual(expected, subject);
        }