Exemplo n.º 1
0
        public void Can_Add_ProjectType()
        {
            //Arrange
            //long Id = 3;
            ProjectType _projecttypeObj = new ProjectType()
            {
                ProjectTypeName        = "MoqProject Test",
                ProjectTypeDescription = "New project type created with Effort and Moq packages",
                //CreatedDate = DateTime.Now,
                //ModifiedDate = DateTime.Now
            };

            //_mockRepository.Setup(m => m.Add(_projecttypeObj)).Returns((ProjectType p) =>
            //{
            //    p.Id = Id;
            //    return p;
            //});


            //Act
            _service.Create(_projecttypeObj);

            //Assert
            //Assert.AreEqual(Id, _projecttypeObj.Id);
            _mockUnitWork.Verify(m => m.Commit(), Times.Once);
        }
Exemplo n.º 2
0
 public HttpResponseMessage CreateProjectType(ProjectType projectType)
 {
     LogManager.GetCurrentClassLogger().Debug("ProjectType API hit");
     if (projectType == null)
     {
         throw new HttpResponseException(HttpStatusCode.Unauthorized);
     }
     _service.Create(projectType);
     return(Request.CreateResponse(HttpStatusCode.OK));
 }