public void TestProductSupplyService_IsWorkingProperly_for_Package() { Reset(); IPeriodConfigurationService serviceConfPer = Provider.GetService <IPeriodConfigurationService>(); IWorkerInWorkPlaceService workerService = Provider.GetService <IWorkerInWorkPlaceService>(); var wInwps = workerService.GetWorkPlaceWhereWorkedTheWorker(workerMocked, null); Assert.IsTrue(wInwps.Count > 0); var workerInWorkPlace = wInwps[0]; //var service = Provider.GetService<IStep<IProductSupplyRequest>>(); //RequestSupplyViewModel req = MockRequestSupplyViewModel("EPI5", userMocked, workerInWorkPlace.WorkPlace.Code, workerInWorkPlace.DateStart.AddDays(100)); //var reqModel = Mappers.Get(req); //var result = service.Execute(reqModel); //Assert.IsTrue(result != null, "result != null"); //Assert.IsTrue(result.ComputeResult().IsOk(), result.Message()); //Assert.IsTrue(reqModel.ProductSupplied != null, "ProductSupplied != null"); //Assert.IsTrue(reqModel.ProductSupplied.Id > 0, "ProductSupplied.Id"); //Assert.IsTrue(reqModel.ProductSupplied.Id == reqModel.ProductSuppliedId, "ProductSupplied.Id == reqModel.IdProductSupplied"); //Assert.IsTrue(reqModel.ProductSupplied.ProductSupplyId == reqModel.WorkerInWorkPlaceId, "ProductSupplied.IdProductSupply == reqModel.IdWorkerInWorkPlace"); //Assert.IsTrue(reqModel.ProductSupplied.ProductStock.BookingId == reqModel.WorkerInWorkPlaceId, "ProductSupplied.ProductStock.IdBooking == reqModel.IdWorkerInWorkPlace"); }
public void TestPeriodConfigurationService_working() { Reset(); IWorkerInWorkPlaceService workerService = Provider.GetService <IWorkerInWorkPlaceService>(); var currentDate = DateTime.Now; var wks = workerService.GetWorkPlaceWhereWorkedTheWorker(workerMocked, currentDate); Assert.IsTrue(wks.Count > 0, "wks.Count > 0"); foreach (var it in wks) { Assert.IsTrue(it.DateStart < DateTime.Now, "DateStart < DateTime.Now"); Assert.IsTrue(!it.DateEnd.HasValue || it.DateEnd.Value > currentDate, "DateFinish.HasValue || it.DateFinish.Value > DateTime.Now"); Assert.IsTrue(it.NumYearsByPeriod > 0, "NumYearsByPeriod > 0"); } }
public void TestConfigSupplyService_IsWorkingProperly() { Reset(); var mapper = GetRepository <IMapper>(); IPeriodConfigurationService serviceConfPer = Provider.GetService <IPeriodConfigurationService>(); IWorkerInWorkPlaceService workerService = Provider.GetService <IWorkerInWorkPlaceService>(); var wInwps = workerService.GetWorkPlaceWhereWorkedTheWorker(workerMocked, null); Assert.IsTrue(wInwps.Count > 0); var workerInWorkPlace = wInwps[0]; var result1 = Task.Run(() => { var service = Provider.GetService <IStep <IManagementModelRequest <IConfigSupply> > >(); ConfigSupplyViewModel req1 = MockRequestConfigViewModel("EPI1", workerMocked, workerInWorkPlace.WorkPlace.Code, workerInWorkPlace.DateStart.AddDays(100), 15); return(service.Execute(new ManagementModelRequest <IConfigSupply> { Item = mapper.Map <IConfigSupply>(req1), Type = Operation.NEW })); }); //var result2 = Task.Run(() => //{ // var service2 = Provider.GetService<IStep<IManagementModelRequest<IConfigSupply>>>(); // ConfigSupplyViewModel req2 = MockRequestConfigViewModel("EPI1", workerMocked, workerInWorkPlace.WorkPlace.Code, workerInWorkPlace.DateStart.AddDays(100), 25); // return service2.Execute(new ManagementModelRequest<IConfigSupply> // { // Item = mapper.Map<IConfigSupply>(req2), // Type = Operation.NEW // }); //}); //var result3 = Task.Run(() => //{ // ConfigSupplyViewModel req3 = MockRequestConfigViewModel("EPI1", workerMocked, workerInWorkPlace.WorkPlace.Code, workerInWorkPlace.DateStart.AddDays(100), 35); // return service3.Execute(new ManagementModelRequest<IConfigSupply> // { // Item = mapper.Map<IConfigSupply>(req3), // Type = Operation.NEW // }); //}); //var result4 = Task.Run(() => //{ // ConfigSupplyViewModel req4 = MockRequestConfigViewModel("EPI1", workerMocked, workerInWorkPlace.WorkPlace.Code, workerInWorkPlace.DateStart.AddDays(100), 45); // var service4 = Provider.GetService<IStep<IManagementModelRequest<IConfigSupply>>>(); // var service4 = Provider.GetService<IStep<IManagementModelRequest<IConfigSupply>>>(); // return service4.Execute(new ManagementModelRequest<IConfigSupply> // { // Item = mapper.Map<IConfigSupply>(req4), // Type = Operation.NEW // }); //}); result1.Wait(); // result2.Wait(); //result3.Wait(); //result4.Wait(); Assert.IsTrue(result1.Result.ComputeResult().IsOk(), result1.Result.Message()); // Assert.IsTrue(result2.Result.ComputeResult().IsOk(), result2.Result.Message()); //Assert.IsTrue(result3.Result.ComputeResult().IsOk(), result3.Result.Message()); //Assert.IsTrue(result4.Result.ComputeResult().IsOk(), result4.Result.Message()); //Assert.IsTrue(result != null, "result != null"); //Assert.IsTrue(result.ComputeResult().IsOk(), result.Message()); //Assert.IsTrue(reqModel.SupplyScheduled != null, "SupplyScheduled != null"); //Assert.IsTrue(reqModel.SupplyScheduled.Id > 0, "SupplyScheduled.Id"); //Assert.IsTrue(reqModel.SupplyScheduled.Amount == req.Amount, "SupplyScheduled.Amount == req.Amount"); }
public GenerateWorkerReport(IWorkerInWorkPlaceService supplyBusinessLogic, IProductSupplyService productSuppliedService) { _workerService = supplyBusinessLogic; _productSuppliedService = productSuppliedService; }
public ValidateAndCompleteWorkerInWorkPlace(IWorkerInWorkPlaceService workerInWorkPlaceService) { _workerInWorkPlaceService = workerInWorkPlaceService; }