public void CreateWorkAssignment_returns_workAssignment() { // //Arrange string user = "******"; var _wa = (WorkAssignment)Records.assignment.Clone(); var _l = (Lookup)Records.lookup.Clone(); _wa.datecreated = DateTime.MinValue; _wa.dateupdated = DateTime.MinValue; _wa.workOrder = (WorkOrder)Records.order.Clone(); _wa.workOrder.paperOrderNum = _wa.workOrder.ID; waRepo.Setup(r => r.Add(_wa)).Returns(_wa); lRepo.Setup(r => r.GetById(It.IsAny <int>())).Returns(_l); // //Act var result = waServ.Create(_wa, user); // //Assert Assert.IsInstanceOfType(result, typeof(WorkAssignment)); Assert.IsTrue(result.createdby == user); Assert.IsTrue(result.updatedby == user); Assert.IsTrue(result.datecreated > DateTime.MinValue); Assert.IsTrue(result.dateupdated > DateTime.MinValue); }
public FluentRecordBase AddWorkAssignment( string desc = null, int?skill = null, DateTime?datecreated = null, DateTime?dateupdated = null, string updatedby = null, bool assignWorker = false ) { // // DEPENDENCIES if (_wo == null) { AddWorkOrder(); } if (assignWorker == true && _w == null) { AddWorker(); } // // ARRANGE _wa = (WorkAssignment)Records.assignment.Clone(); _wa.workOrder = _wo; if (assignWorker) { _wa.workerAssigned = _w; } if (datecreated != null) { _wa.datecreated = (DateTime)datecreated; } if (dateupdated != null) { _wa.dateupdated = (DateTime)dateupdated; } if (desc != null) { _wa.description = desc; } if (updatedby != null) { _user = updatedby; } if (skill != null) { _wa.skillID = (int)skill; } // // ACT _servWA.Create(_wa, _user); return(this); }