public void SetUp() { _request = new CompanyDetailsRequest("companyName", "can", "address1", "address2", "address3", "address4", "postcode", "tel", "website", "mainContact", "actioningUser", "businessSafeContact"); var employee = new EmployeeForAuditing() { Forename = "George", Surname = "Best", Id = Guid.NewGuid() }; _request.ExistingCompanyDetails = new Application.Request.CompanyDetailsInformation() { AddressLine1 = "existing address line 1", AddressLine2 = "existing address line 2", AddressLine3 = "existing address line 3", AddressLine4 = "existing address line 4", CompanyName = "existing CompanyName", MainContact = "existing MainContact", Postcode = "existing PostCode", Telephone = "existing Telephone", Website = "existing Website", BusinessSafeContactId = employee.Id, BusinessSafeContactName = employee.FullName }; ; _bus = new Mock<IBus>(); _log = new Mock<IPeninsulaLog>(); ObjectFactory.Inject<IPeninsulaLog>(new StubPeninsulaLog()); }
public void Update(CompanyDetailsRequest request) { _log.Add(request); try { _bus.Send(new SendCompanyDetailsUpdatedEmail() { CompanyId = request.Id, CAN = request.CAN, ActioningUserName = request.ActioningUserName, ExistingCompanyDetailsInformation = MapCompanyDetailsInformation(request.ExistingCompanyDetails), NewCompanyDetailsInformation = MapCompanyDetailsInformation(request.NewCompanyDetails) } ); } catch (Exception ex) { _log.Add(ex); throw; } }
public void Setup() { _employeeForAuditingRepository = new Mock<IEmployeeForAuditingRepository>(); _businessSafeCompanyDetailRepository = new Mock<IBusinessSafeCompanyDetailRepository>(); _userForAuditingRepository = new Mock<IUserForAuditingRepository>(); _companyId = 1234L; _employee = new EmployeeForAuditing() { Id = Guid.NewGuid(), Forename = "Denis", Surname = "Irwin" }; _companyDetails = new BusinessSafeCompanyDetail() { CompanyId = _companyId, BusinessSafeContactEmployee = _employee }; _request = new CompanyDetailsRequest { Id = default(long), CAN = "can", NewCompanyDetails = new CompanyDetailsInformation() { AddressLine1 = "address line 1", AddressLine2 = "address line 2", AddressLine3 = "address line 3", AddressLine4 = "address line 4", CompanyName = "CompanyName", MainContact = "MainContact", Postcode = "PostCode", Telephone = "Telephone", Website = "Website", BusinessSafeContactId = _employee.Id, BusinessSafeContactName = _employee.FullName } }; _businessSafeCompanyDetailRepository .Setup(x => x.GetByCompanyId(It.IsAny<long>())) .Returns(_companyDetails); _employeeForAuditingRepository .Setup(x => x.GetByIdAndCompanyId(It.IsAny<Guid>(), It.IsAny<long>())) .Returns(_employee); _employeeForAuditingRepository .Setup(x => x.GetByIdAndCompanyIdWithoutChecking(It.IsAny<Guid>(), It.IsAny<long>())) .Returns(_employee); _userForAuditingRepository .Setup(x => x.GetByIdAndCompanyId(It.IsAny<Guid>(), It.IsAny<long>())) .Returns(_user); _log = new Mock<IPeninsulaLog>(); _log.Setup(x => x.Add(It.IsAny<object>())); _target = GetTarget(); }
private Expression<Func<BusinessSafeCompanyDetail, bool>> matchesUpdateCompanyDetailsRequestProperties(CompanyDetailsRequest request) { return y => y.BusinessSafeContactEmployee.FullName == request.NewCompanyDetails.BusinessSafeContactName; }