Exemplo n.º 1
0
 public override void Update()
 {
     RegistrateCompanyViewModel.Update();
     RegistratePersonViewModel.Update();
     RegisterInvoiceViewModel.Update();
     InvoiceViewModel.Update();
 }
Exemplo n.º 2
0
		public void SaveTest()
		{
			var companyToSave = new Company {Id = 1, Name = "Company1"};

			var companyDataAccessMock = new Mock<ICompanyDataAccess>();
			companyDataAccessMock.Setup(cA => cA.LoadCompany(companyToSave.Id)).Returns(companyToSave);

			var viewModel = new RegistrateCompanyViewModel(companyDataAccessMock.Object) { Comp = { Id = companyToSave.Id, Name = companyToSave.Name } };
			viewModel.Save();

			var loadedCompany = companyDataAccessMock.Object.LoadCompany(companyToSave.Id);

			Assert.AreEqual(companyToSave.Id, loadedCompany.Id);
			Assert.AreEqual(companyToSave.Name, loadedCompany.Name);
		}
Exemplo n.º 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);
		}
Exemplo n.º 4
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);
        }