コード例 #1
0
ファイル: MainViewModel.cs プロジェクト: acid84/UHS
 public override void Update()
 {
     RegistrateCompanyViewModel.Update();
     RegistratePersonViewModel.Update();
     RegisterInvoiceViewModel.Update();
     InvoiceViewModel.Update();
 }
コード例 #2
0
ファイル: MainViewModel.cs プロジェクト: acid84/UHS
		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
ファイル: MainViewModel.cs プロジェクト: acid84/UHS
        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);
		}