Пример #1
0
 public override void Update()
 {
     RegistrateCompanyViewModel.Update();
     RegistratePersonViewModel.Update();
     RegisterInvoiceViewModel.Update();
     InvoiceViewModel.Update();
 }
Пример #2
0
		public MainViewModel()
		{
			var personData = new PersonDataAccess(RepositoryFactory<Person>.GetRepository());
			var companyData = new CompanyDataAccess(RepositoryFactory<Company>.GetRepository());
			var invoiceData = new InvoiceDataAccess(RepositoryFactory<Invoice>.GetRepository(), RepositoryFactory<InvoiceRow>.GetRepository());
			var userData = new UserDataAccess(RepositoryFactory<User>.GetRepository());

			RegistratePersonViewModel = new RegistratePersonViewModel(personData);
			RegistrateCompanyViewModel = new RegistrateCompanyViewModel(companyData);
			RegisterInvoiceViewModel = new RegistrateInvoiceViewModel(invoiceData, companyData, personData);
			InvoiceViewModel = new InvoiceViewModel(invoiceData);


			userData.AddUser("admin", "admin");
			LoginViewModel = new LoginViewModel(userData);
		}
Пример #3
0
        public MainViewModel()
        {
            var personData  = new PersonDataAccess(RepositoryFactory <Person> .GetRepository());
            var companyData = new CompanyDataAccess(RepositoryFactory <Company> .GetRepository());
            var invoiceData = new InvoiceDataAccess(RepositoryFactory <Invoice> .GetRepository(), RepositoryFactory <InvoiceRow> .GetRepository());
            var userData    = new UserDataAccess(RepositoryFactory <User> .GetRepository());

            RegistratePersonViewModel  = new RegistratePersonViewModel(personData);
            RegistrateCompanyViewModel = new RegistrateCompanyViewModel(companyData);
            RegisterInvoiceViewModel   = new RegistrateInvoiceViewModel(invoiceData, companyData, personData);
            InvoiceViewModel           = new InvoiceViewModel(invoiceData);


            userData.AddUser("admin", "admin");
            LoginViewModel = new LoginViewModel(userData);
        }
Пример #4
0
		public void SaveTest()
		{
			var personToSave = new Person {Id = Guid.NewGuid(), Name = "Micke"};

			var personDataAccessMock = new Mock<IPersonDataAccess>();
			personDataAccessMock.Setup(pA => pA.LoadPerson(personToSave.Id)).Returns(personToSave);

			var viewModel = new RegistratePersonViewModel(personDataAccessMock.Object)
			                	{
			                		Pers =
			                			{
			                				Id = personToSave.Id,
			                				Name = personToSave.Name
			                			}
			                	};

			viewModel.Save();

			var loadedPerson = personDataAccessMock.Object.LoadPerson(personToSave.Id);

			Assert.AreEqual(personToSave.Id, loadedPerson.Id);
			Assert.AreEqual(personToSave.Name, loadedPerson.Name);
		}