public HttpResponseMessage Put(string id, [FromBody] UpdateProductionBatchParameters value) { if (!ModelState.IsValid) { return(new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent(ModelState.GetErrorSummary()) }); } value.ProductionBatchKey = id; _userIdentityProvider.SetUserIdentity(value); var result = _productionService.UpdateProductionBatch(value); return(result.ToHttpResponseMessage(HttpVerbs.Put)); }
public void Updates_existing_tblLot_record_and_KillSwitch_will_not_have_been_engaged_if_service_method_and_synchronization_were_successful() { //Arrange var parameters = new UpdateProductionBatchParameters { UserToken = TestUser.UserName, BatchTargetWeight = 1.0, BatchTargetAsta = 2.0, BatchTargetScan = 3.0, BatchTargetScoville = 4.0, Notes = "UpdateBatchNotes" }; var productionBatch = RVCUnitOfWork.ProductionBatchRepository.All().FirstOrDefault(b => b.TargetParameters.BatchTargetWeight != parameters.BatchTargetWeight || b.TargetParameters.BatchTargetAsta != parameters.BatchTargetAsta || b.TargetParameters.BatchTargetScan != parameters.BatchTargetScan || b.TargetParameters.BatchTargetScoville != parameters.BatchTargetScoville); if (productionBatch == null) { throw new Exception("Could not find valid test ProductionBatch."); } parameters.ProductionBatchKey = new LotKey(productionBatch); //Act var result = Service.UpdateProductionBatch(parameters); var lotString = GetKeyFromConsoleString(ConsoleOutput.UpdatedLot); //Assert result.AssertSuccess(); MockKillSwitch.Verify(k => k.Engage(), Times.Never()); var newLot = int.Parse(lotString); var lot = new RioAccessSQLEntities().tblLots.FirstOrDefault(t => t.Lot == newLot); parameters.AssertAsExpected(lot); }