public static void AddOrUpdateAddress_UpdatesAddress( Address existingAddress, AddressModel newOrUpdatedAddress, ContactDetailsService service) { existingAddress.Should().NotBeNull(); newOrUpdatedAddress.Should().NotBeNull(); var expected = new Address { Id = existingAddress.Id, Line1 = newOrUpdatedAddress.Line1, Line2 = newOrUpdatedAddress.Line2, Line3 = newOrUpdatedAddress.Line3, Line4 = newOrUpdatedAddress.Line4, Line5 = newOrUpdatedAddress.Line5, Town = newOrUpdatedAddress.Town, County = newOrUpdatedAddress.County, Postcode = newOrUpdatedAddress.Postcode, Country = newOrUpdatedAddress.Country, }; var result = service.AddOrUpdateAddress(existingAddress, newOrUpdatedAddress); result.Should().BeEquivalentTo(expected); }
public static void AddOrUpdateAddress_NullExistingAddress_NullNewAddress( ContactDetailsService service) { var result = service.AddOrUpdateAddress(null, null); result.Should().BeNull(); }
public static void AddOrUpdatePrimaryContact_NullExistingContact_NullNewContact( ContactDetailsService service) { Contact expected = new Contact(); var result = service.AddOrUpdatePrimaryContact(null, null); result.Should().BeEquivalentTo(expected); }
public static void AddOrUpdateAddress_NullNewAddress( Address existingAddress, ContactDetailsService service) { existingAddress.Should().NotBeNull(); var result = service.AddOrUpdateAddress(existingAddress, null); result.Should().BeEquivalentTo(existingAddress); }
public static void AddOrUpdatePrimaryContact_NullNewContact( Contact existingContact, ContactDetailsService service) { existingContact.Should().NotBeNull(); var result = service.AddOrUpdatePrimaryContact(existingContact, null); result.Should().BeEquivalentTo(existingContact); }
public static void AddOrUpdatePrimaryContact_NullExistingContact( PrimaryContactModel newOrUpdatedContact, ContactDetailsService service) { newOrUpdatedContact.Should().NotBeNull(); var expected = new Contact { FirstName = newOrUpdatedContact.FirstName, LastName = newOrUpdatedContact.LastName, Email = newOrUpdatedContact.EmailAddress, Phone = newOrUpdatedContact.TelephoneNumber, }; var result = service.AddOrUpdatePrimaryContact(null, newOrUpdatedContact); result.Should().BeEquivalentTo(expected); }
public IComponent GetComponent(IPublishedContent componentContent, IPublishedContent pageContent) { var documentTypeAlias = componentContent.DocumentTypeAlias; switch (documentTypeAlias) { case DocumentTypeAliases.Banner: var bannerService = new BannerService(); return(bannerService.GetViewModel(componentContent)); case DocumentTypeAliases.InformationWithoutBackground: var informationWithoutBackgroundService = new InformationWithoutBackgroundService(); return(informationWithoutBackgroundService.GetViewModel(componentContent)); case DocumentTypeAliases.InformationWithoutBackgroundVertical: var informationWithBackgroundVerticalService = new InformationWithoutBackgroundVerticalService(); return(informationWithBackgroundVerticalService.GetViewModel(componentContent)); case DocumentTypeAliases.InformationWithBackground: var informationWithBackgroundService = new InformationWithBackgroundService(); return(informationWithBackgroundService.GetViewModel(componentContent)); case DocumentTypeAliases.ContactForm: var contactFormService = new ContactFormService(); return(contactFormService.GetViewModel(componentContent)); case DocumentTypeAliases.ContactDetails: var contactDetailsService = new ContactDetailsService(); return(contactDetailsService.GetViewModel(componentContent)); case DocumentTypeAliases.Footer: var footerService = new FooterService(); return(footerService.GetViewModel(componentContent)); } return(null); }