예제 #1
0
		public void CreateCompanyWithAppraisalCompanyAdminUser(AppraisalCompanySignUpViewModel viewModel, AddressViewModel companyAddressModel)
		{
			AppraisalCompanyProfileViewModel companyViewModel = new AppraisalCompanyProfileViewModel();
			companyViewModel.CompanyName = viewModel.CompanyName;
			companyViewModel.CompanyType = viewModel.CompanyType.HasValue && viewModel.CompanyType.Value != 0 ? viewModel.CompanyType : null;

			var dbCompany = _appraisalCompanyManagement.CreateAppraisalCompany(companyViewModel);
			dbCompany.Contact = new AppraisalCompanyContact();
			if (companyAddressModel != null)
			{
				dbCompany.Contact.PhysicalAddress = new Address()
																		{
																			City = companyAddressModel.City,
																			State = companyAddressModel.State.Substring(0,2),
																			Street = companyAddressModel.Street,
																			Street2 = companyAddressModel.Street2,
																			ZIP = companyAddressModel.ZIP,
																		};
			}
			else
			{
				dbCompany.Contact.PhysicalAddress = new Address() { State = viewModel.LocationState.Substring(0, 2) };
			}

			var user = _usersManagement.CreateUser(viewModel.AppraisalCompanyAdmin, RoleType.CompanyAdminAndAppraiser);
			AppraiserUser appraiserUser = new AppraiserUser();
			appraiserUser.Company = dbCompany;
			appraiserUser.User = user;
			appraiserUser.Status = AppraiserUserStatus.Applied;

			_appraisalCompanyAdminManagement.CreateUser(appraiserUser);
		}
		public void CreateCompanyWithAppraisalCompanyAdminUser_should_create_AppraisalCompanyAdmin_and_populate_with_default_values()
		{
			AppraisalCompanySignUpViewModel appraisalCompanySignUpViewModel = new AppraisalCompanySignUpViewModel() { LocationState = "CA, California" };
			AppraisalCompanyDetail companyDetails = new AppraisalCompanyDetail();
			AppraisalCompanyManagement.CreateAppraisalCompany(Arg.Any<AppraisalCompanyProfileViewModel>()).Returns(companyDetails);

			//act
			Target.CreateCompanyWithAppraisalCompanyAdminUser(appraisalCompanySignUpViewModel);
			AppraiserManagement.Received().CreateUser(Arg.Is<AppraiserUser>(aca => aca.Status == AppraiserUserStatus.Applied));
		}
예제 #3
0
		public void CreateCompanyWithAppraisalCompanyAdminUser(AppraisalCompanyAddViewModel viewModel)
		{
			AppraisalCompanySignUpViewModel signUpViewModel = new AppraisalCompanySignUpViewModel
			{
				AppraisalCompanyAdmin = viewModel.AppraisalCompanyAdmin,
				CompanyName = viewModel.CompanyName,
				LocationState = viewModel.PhysicalAddress.State.Substring(0, 2),
				CompanyType = 			viewModel.CompanyType
			};
			CreateCompanyWithAppraisalCompanyAdminUser(signUpViewModel, viewModel.PhysicalAddress);
		}
예제 #4
0
		public ActionResult Index(AppraisalCompanySignUpViewModel model)
		{
			if (ModelState.IsValid)
			{
				_appraisalCompanySignUpService.CreateCompanyWithAppraisalCompanyAdminUser(model);
				CommitProviderInstance.Commit();
				_authenticationProvider.SetAuthCookie(model.AppraisalCompanyAdmin.Email, false, Response);

				return RedirectToAction(NameHelper.AppraisalCompanyWizard.Index, NameHelper.AppraisalCompanyWizard.Controller, new { area = "SignUp" });
			}

			return View(model);
		}
		public void CreateCompanyWithAppraisalCompanyAdminUser_should_create_AppraisalCompanyAdmin_from_AppraisalCompanyAddViewModel()
		{
			var model = new AppraisalCompanyAddViewModel()
				{
					AppraisalCompanyAdmin = new DVS.Logic.ViewModels.UserViewModel() { FirstName = "first", LastName = "last", Email = "*****@*****.**" },
					CompanyName = "name",
					PhysicalAddress = new DVS.Logic.ViewModels.AddressViewModel() { City = "city", State = "CA, California", Street = "street", ZIP = "00000" }
				};
			AppraisalCompanySignUpViewModel appraisalCompanySignUpViewModel = new AppraisalCompanySignUpViewModel() { LocationState = "CA, California" };
			AppraisalCompanyDetail companyDetails = new AppraisalCompanyDetail();
			AppraisalCompanyManagement.CreateAppraisalCompany(Arg.Any<AppraisalCompanyProfileViewModel>()).Returns(companyDetails);

			//act
			Target.CreateCompanyWithAppraisalCompanyAdminUser(model);
			AppraiserManagement.Received().CreateUser(Arg.Is<AppraiserUser>(aca => aca.Status == AppraiserUserStatus.Applied));
		}
		public void CreateCompanyWithAppraisalCompanyAdminUser_should_create_AppraisalCompanyViewModel_and_populate_it()
		{
			var user = new User();
			UsersManagement.CreateUser(Arg.Any<UserViewModel>(), Arg.Any<RoleType>()).Returns(user);

			string companyName = "TestCompany";
			AppraisalCompanySignUpViewModel appraisalCompanySignUpViewModel = new AppraisalCompanySignUpViewModel() { LocationState = "CA, California" };
			appraisalCompanySignUpViewModel.CompanyName = companyName;
			AppraisalCompanyDetail companyDetails = new AppraisalCompanyDetail();
			AppraisalCompanyManagement.CreateAppraisalCompany(Arg.Any<AppraisalCompanyProfileViewModel>()).Returns(companyDetails);

			//act
			Target.CreateCompanyWithAppraisalCompanyAdminUser(appraisalCompanySignUpViewModel);
			AppraisalCompanyManagement.Received().CreateAppraisalCompany(Arg.Is<AppraisalCompanyProfileViewModel>(ac =>
				string.Equals(ac.CompanyName, companyName)));
		}
예제 #7
0
		public void CreateCompanyWithAppraisalCompanyAdminUser(AppraisalCompanySignUpViewModel viewModel)
		{
			CreateCompanyWithAppraisalCompanyAdminUser(viewModel, null);
		}