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 MainViewModel() { SnackMachine snackMachine = new SnackMachineRepository().GetById(1); var viewModel = new SnackMachineViewModel(snackMachine); _dialogService.ShowDialog(viewModel); }
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 SnackMachineView() { InitializeComponent(); var snackMachine = new SnackMachineRepository().GetById(1); var viewModel = new SnackMachineViewModel(snackMachine); DataContext = viewModel; }
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 SnackMachineViewModel(Logic.SnackMachines.SnackMachine snackMachine) { _snackMachine = snackMachine; _repository = new SnackMachineRepository(); InsertCentCommand = new Command(() => InsertMoney(Money.Cent)); InsertTenCentCommand = new Command(() => InsertMoney(Money.TenCent)); InsertQuarterCommand = new Command(() => InsertMoney(Money.Quarter)); InsertDollarCommand = new Command(() => InsertMoney(Money.Dollar)); InsertFiveDollarCommand = new Command(() => InsertMoney(Money.FiveDollar)); InsertTwentyDollarCommand = new Command(() => InsertMoney(Money.TwentyDollar)); ReturnMoneyCommand = new Command(() => ReturnMoney()); BuySnackCommand = new Command <string>(BuySnack); }
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 SnackMachineViewModel(SnackMachine snackMachine) { _snackMachine = snackMachine; _repository = new SnackMachineRepository(); InsertCentCommand = new Command(() => InsertMoney(Money.Cent)); InsertTenCentCommand = new Command(() => InsertMoney(Money.TenCent)); InsertQuarterCommand = new Command(() => InsertMoney(Money.Quarter)); InsertDollarCommand = new Command(() => InsertMoney(Money.Dollar)); InsertFiveDollarCommand = new Command(() => InsertMoney(Money.FiveDollar)); InsertTwentyDollarCommand = new Command(() => InsertMoney(Money.TwentyDollar)); ReturnMoneyCommand = new Command(() => ReturnMoney()); BuySnackCommand = new Command<string>(BuySnack); }
public DashboardViewModel() { HeadOffice = HeadOfficeInstance.Instance; _snackMachineRepository = new SnackMachineRepository(); _atmRepository = new AtmRepository(); _headOfficeRepository = new HeadOfficeRepository(); RefreshAll(); ShowSnackMachineCommand = new Command<SnackMachineDto>(x => x != null, ShowSnackMachine); UnloadCashCommand = new Command<SnackMachineDto>(CanUnloadCash, UnloadCash); ShowAtmCommand = new Command<AtmDto>(x => x != null, ShowAtm); LoadCashToAtmCommand = new Command<AtmDto>(CanLoadCashToAtm, LoadCashToAtm); }
public MainViewModel() { // var viewModel = new SnackMachineViewModel(new SnackMachine()); // _dialogService.ShowDialog(viewModel); SnackMachine snackMachine = new SnackMachineRepository().GetById(1); //SnackMachine snackMachine; //using (ISession session = SessionFactory.OpenSession()) //{ // snackMachine = session.Get<SnackMachine>(1L); //} var viewModel = new SnackMachineViewModel(snackMachine); // _dialogService.ShowDialog(viewModel); }
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); }