public void Creates_new_tblLot_record_and_KillSwitch_will_not_have_been_engaged_if_service_method_and_synchronization_were_successful()
            {
                //Arrange
                var packSchedule = RVCUnitOfWork.PackScheduleRepository.All().Where(p => p.PSNum != null).OrderByDescending(p => p.DateCreated).FirstOrDefault();

                if (packSchedule == null)
                {
                    throw new Exception("Could not find valid test PackSchedule.");
                }

                //Act
                var param = new CreateProductionBatchParameters
                {
                    PackScheduleKey = new PackScheduleKey(packSchedule),
                    UserToken       = TestUser.UserName,
                    Instructions    = new[]
                    {
                        "Instruction 0",
                        "Instruction 1",
                        "Instruction 2"
                    }
                };
                var result    = Service.CreateProductionBatch(param);
                var lotString = GetKeyFromConsoleString(ConsoleOutput.AddedLot);

                //Assert
                result.AssertSuccess();
                MockKillSwitch.Verify(k => k.Engage(), Times.Never());

                var newLot = int.Parse(lotString);

                Assert.IsNotNull(new RioAccessSQLEntities().tblLots.FirstOrDefault(t => t.Lot == newLot));
            }
            public void Assigns_lot_key_as_expected()
            {
                //Arrange
                var packSchedule = RVCUnitOfWork.PackScheduleRepository.All().Where(p => p.PSNum != null).OrderByDescending(p => p.DateCreated).FirstOrDefault();

                if (packSchedule == null)
                {
                    throw new Exception("Could not find valid test PackSchedule.");
                }

                //Act
                var lotType        = 3;
                var lotDateCreated = new DateTime(2017, 1, 1);
                var lotSequence    = 24;

                var param = new CreateProductionBatchParameters
                {
                    PackScheduleKey = new PackScheduleKey(packSchedule),
                    UserToken       = TestUser.UserName,
                    Instructions    = new[]
                    {
                        "Instruction 0",
                        "Instruction 1",
                        "Instruction 2"
                    },

                    LotType        = (LotTypeEnum?)lotType,
                    LotDateCreated = lotDateCreated,
                    LotSequence    = lotSequence
                };
                var result = Service.CreateProductionBatch(param);

                //Assert
                result.AssertSuccess();
                var lot = TestHelper.Context.Lots.FirstOrDefault(l => l.LotTypeId == lotType && l.LotDateCreated == lotDateCreated && l.LotDateSequence == lotSequence);

                Assert.IsNotNull(lot);
            }