Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        public void Test()
        {
            SessionFactory.Init(ConfigurationManager.ConnectionStrings["SnackMachine"].ConnectionString);

            var repository   = new SnackMachineRepository();
            var snackMachine = repository.GetById(1);

            snackMachine.Should().NotBe(null);
        }
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        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);
        }