private void UnloadCash(SnackMachineDto snackMachineDto) { var snackMachine = _snackMachineRepository.GetById(snackMachineDto.Id); if (snackMachine == null) return; HeadOffice.UnloadCashFromSnackMachine(snackMachine); _snackMachineRepository.Save(snackMachine); _headOfficeRepository.Save(HeadOffice); RefreshAll(); }
public void TempTest2() { SessionFactory.Init(@"Server=GOLPE\SQLEXPRESS;Database=DDDInPrcatice;Integrated Security=true;User=test;Password=Uuxwp7Mcxo7Khy! "); var repo = new SnackMachineRepository(); var machine = repo.GetById(1); }
public void Test() { //var connectionString = ConfigurationManager.ConnectionStrings["SnackMachineDDDDatabase"].ConnectionString; SessionFactory.Init(@"Server=.;Database=SnackMachineDDD;Trusted_Connection=True;"); //using (ISession session = SessionFactory.OpenSession()) //{ // long id = 1; // //var snackMachine = session.Get<SnackMachine>(id); // var repository = new SnackMachineRepository(); // var snackMachine = repository.GetById(1); // snackMachine.InsertMoney(OneDollar); // snackMachine.InsertMoney(OneDollar); // snackMachine.InsertMoney(OneDollar); // snackMachine.BuySnack(1); // repository.Save(snackMachine); //} //var snackMachine = session.Get<SnackMachine>(id); var repository = new SnackMachineRepository(); var snackMachine = repository.GetById(1); snackMachine.InsertMoney(OneDollar); snackMachine.InsertMoney(OneDollar); snackMachine.InsertMoney(OneDollar); snackMachine.BuySnack(1); repository.Save(snackMachine); }
public void Test() { SessionFactory.Init(ConfigurationManager.ConnectionStrings["SnackMachine"].ConnectionString); var repository = new SnackMachineRepository(); var snackMachine = repository.GetById(1); snackMachine.Should().NotBe(null); }
public void TestRepository() { SessionFactory.Init("Server=(localdb)\\mssqllocaldb;Database=DddInPractice;Trusted_Connection=True;"); SnackMachineRepository repository = new SnackMachineRepository(); SnackMachine snackMachine = repository.GetById(1); HeadOfficeInstance.Init(); HeadOffice headOffice = HeadOfficeInstance.Instance; }
public void Test() { SessionFactory.Init(@"Server=.;Database=DddInPractice;Trusted_Connection=True"); var repository = new SnackMachineRepository(); var snackMachine = repository.GetById(1); snackMachine.InsertMoney(Money.Dollar); snackMachine.InsertMoney(Money.Dollar); snackMachine.InsertMoney(Money.Dollar); snackMachine.BuySnack(1); repository.Save(snackMachine); }
public void GetSnackMachineAndBuySnackTest() { const long id = 1; var repository = new SnackMachineRepository(); var snackMachine = repository.GetById(id); snackMachine.InsertMoney(Dollar); snackMachine.InsertMoney(Dollar); snackMachine.InsertMoney(Dollar); snackMachine.BuySnack(1); repository.Save(snackMachine); }
public MainViewModel() { Initer.Init(@"Server=(localdb)\MSSqlLocalDB;Database=DDDInPractice;Trusted_Connection=true"); var repository = new SnackMachineRepository(); var snackMachine = repository.GetById(1L); var viewModel = new SnackMachineViewModel(snackMachine); _dialogService.ShowDialog(viewModel); }
public void Test() { SessionFactory.Init(ConfigurationManager.ConnectionStrings["DDDInPractice"].ConnectionString); var repository = new SnackMachineRepository(); var snackMachine = repository.GetById(1); snackMachine.InsertMoney(Dollar); snackMachine.InsertMoney(Dollar); snackMachine.InsertMoney(Dollar); snackMachine.BuySnack(1); repository.Save(snackMachine); }
public void Test() { SessionFactory.Init(@"Server=(localdb)\mssqllocaldb;Database=DddInPractice;Trusted_Connection=True;"); // using (ISession session = SessionFactory.OpenSession()) // { // long id = 1; // var snackMachine = session.Get<SnackMachine>(id); // } var repository = new SnackMachineRepository(); SnackMachine snackMachine = repository.GetById(1); snackMachine.InsertMoney(Money.Dollar); snackMachine.InsertMoney(Money.Dollar); snackMachine.InsertMoney(Money.Dollar); snackMachine.BuySnack(1); repository.Save(snackMachine); }