public void CreateAgency_NullAgencyType_CreatesAnAgency() { var agencyRepository = new Mock <IAgencyRepository>(); var agencyFactory = new AgencyFactory(agencyRepository.Object); AgencyProfile agencyProfileWithoutAgencyType = new AgencyProfileBuilder().WithAgencyName(new AgencyNameBuilder().WithLegalName(LegalName)); agencyFactory.CreateAgency(agencyProfileWithoutAgencyType); }
public void CreateAgency_WhitespaceLegalName_CreatesAnAgency() { var agencyRepository = new Mock <IAgencyRepository>(); var agencyFactory = new AgencyFactory(agencyRepository.Object); var agencyType = new Mock <AgencyType>(); AgencyProfile agencyProfileWithWhitespaceLegalName = new AgencyProfileBuilder().WithAgencyType(agencyType.Object).WithAgencyName(new AgencyNameBuilder().WithLegalName(" ")); agencyFactory.CreateAgency(agencyProfileWithWhitespaceLegalName); }
public void CreateAgency_WithValidArguments_CreatesAnAgency() { var agencyRepository = new Mock <IAgencyRepository>(); var agencyFactory = new AgencyFactory(agencyRepository.Object); var agencyType = new Mock <AgencyType>(); AgencyProfile agencyProfile = new AgencyProfileBuilder().WithAgencyType(agencyType.Object).WithAgencyName(new AgencyNameBuilder().WithLegalName(LegalName)); var agency = agencyFactory.CreateAgency(agencyProfile); Assert.IsNotNull(agency); }
public void CreateAgency_WithValidArguments_AgencyIsMadePersistent() { bool isPersistent = false; var agencyRepository = new Mock <IAgencyRepository>(); agencyRepository.Setup(a => a.MakePersistent(It.IsAny <Agency>())).Callback(() => isPersistent = true); var agencyFactory = new AgencyFactory(agencyRepository.Object); var agencyType = new Mock <AgencyType>(); AgencyProfile agencyProfile = new AgencyProfileBuilder().WithAgencyType(agencyType.Object).WithAgencyName(new AgencyNameBuilder().WithLegalName(LegalName)); agencyFactory.CreateAgency(agencyProfile); Assert.IsTrue(isPersistent); }
public void CreateAgency_WithValidArguments_AgencyIsEditable() { using (var serviceLocatorFixture = new ServiceLocatorFixture()) { // Setup SetupServiceLocatorFixture(serviceLocatorFixture); var agencyRepository = new Mock <IAgencyRepository>(); var agencyFactory = new AgencyFactory(agencyRepository.Object); var agencyType = new Mock <AgencyType>(); AgencyProfile agencyProfileWithoutDisplayName = new AgencyProfileBuilder().WithAgencyType(agencyType.Object).WithAgencyName(new AgencyNameBuilder().WithLegalName(LegalName)); var agency = agencyFactory.CreateAgency(agencyProfileWithoutDisplayName); AgencyProfile agencyProfileWithDisplayName = new AgencyProfileBuilder().WithAgencyType(agencyType.Object).WithAgencyName( new AgencyNameBuilder().WithLegalName(LegalName).WithDisplayName("My Agency Display Name")); agency.ReviseAgencyProfile(agencyProfileWithDisplayName); } }