public FluentRecordBase AddEmployer( DateTime?datecreated = null, DateTime?dateupdated = null ) { // // DEPENDENCIES if (_servE == null) { AddServEmployer(); } // // ARRANGE _emp = (Employer)Records.employer.Clone(); if (datecreated != null) { _emp.datecreated = (DateTime)datecreated; } if (dateupdated != null) { _emp.dateupdated = (DateTime)dateupdated; } // // ACT _servE.Create(_emp, _user); return(this); }
public void CreateEmployer_returns_employer() { // //Arrange _repo = new Mock <IEmployerRepository>(); _uow = new Mock <IUnitOfWork>(); _woServ = new Mock <IWorkOrderService>(); _map = new Mock <IMapper>(); string user = "******"; var _e = (Employer)Records.employer.Clone(); _e.datecreated = DateTime.MinValue; _e.dateupdated = DateTime.MinValue; _repo.Setup(r => r.Add(_e)).Returns(_e); var _serv = new EmployerService(_repo.Object, _woServ.Object, _uow.Object, _map.Object); // //Act var result = _serv.Create(_e, user); // //Assert Assert.IsInstanceOfType(result, typeof(Employer)); Assert.IsTrue(result.createdby == user); Assert.IsTrue(result.updatedby == user); Assert.IsTrue(result.datecreated > DateTime.MinValue); Assert.IsTrue(result.dateupdated > DateTime.MinValue); }
public void EmployerService_CreateEmployer_returns_employer() { // //Arrange _repo = new Mock<IEmployerRepository>(); _uow = new Mock<IUnitOfWork>(); _woServ = new Mock<IWorkOrderService>(); string user = "******"; var _e = (Employer)Records.employer.Clone(); _e.datecreated = DateTime.MinValue; _e.dateupdated = DateTime.MinValue; _repo.Setup(r => r.Add(_e)).Returns(_e); var _serv = new EmployerService(_repo.Object, _woServ.Object, _uow.Object); // //Act var result = _serv.Create(_e, user); // //Assert Assert.IsInstanceOfType(result, typeof(Employer)); Assert.IsTrue(result.Createdby == user); Assert.IsTrue(result.Updatedby == user); Assert.IsTrue(result.datecreated > DateTime.MinValue); Assert.IsTrue(result.dateupdated > DateTime.MinValue); }
public ActionResult <Employer> Create([FromBody] Employer employer) { _employerService.Create(employer); return(Ok()); }