Пример #1
0
        public void MapFromDatabaseEntity_ValidProject_ReturnValidProjectDTO()
        {
            //Arrange
            var project = new Project
            {
                Id = new Guid("b58b6a58-2064-4c71-9b3d-c8c4514159a9"),
                ProjectInformation = new ProjectInformation(),
                CapitalPlan        = new CapitalPlan(),
                //Estimate = new Estimate(),
                RequisitionHeaders = new List <RequisitionHeader>(),
                POHeaders          = new List <POHeader>(),
                InvoiceHeaders     = new List <InvoiceHeader>(),
                //ScheduleDate = new ScheduleDate(),
                //BudgetMovementLog = new BudgetMovementLog()
            };

            //Act
            var result = ProjectDTO.MapFromDatabaseEntity(project);

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(project.Id, result.Id);
            Assert.IsNotNull(result.ProjectInformation);
            Assert.IsNotNull(result.CapitalPlan);
            //Assert.IsNotNull(result.Estimate);
            Assert.IsNotNull(result.RequisitionHeaders);
            Assert.IsNotNull(result.POHeaders);
            Assert.IsNotNull(result.InvoiceHeaders);
            //Assert.IsNotNull(result.ScheduleDate);
            //Assert.IsNotNull(result.BudgetMovementLog);
        }
Пример #2
0
        public void MapFromDatabaseEntity_NullProject_ReturnNull()
        {
            //Act
            var result = ProjectDTO.MapFromDatabaseEntity(null);

            //Assert
            Assert.IsNull(result);
        }
Пример #3
0
 public ProjectDTO Get(Guid id)
 {
     return(ProjectDTO.MapFromDatabaseEntity(_repository.Get(id)));
 }
Пример #4
0
        public ProjectDTO Add(ProjectDTO projectDTO)
        {
            var response = _repository.Add(Project.MapFromDomainEntity(projectDTO));

            return(ProjectDTO.MapFromDatabaseEntity(response));
        }