예제 #1
0
        public OrganizationMainTranslatorTest()
        {
            unitOfWorkMock = unitOfWorkMockSetup.Object;
            SetupTypesCacheMock <PhoneNumberType>(typeof(PhoneNumberTypeEnum));
            SetupTypesCacheMock <ServiceChargeType>(typeof(ServiceChargeTypeEnum));
            SetupTypesCacheMock <NameType>(typeof(NameTypeEnum));

            translators = new List <object>()
            {
                new OrganizationMainTranslator(ResolveManager, TranslationPrimitives, CacheManager.TypesCache),
                new PublishingStatusTypeTranslator(ResolveManager, TranslationPrimitives),

                RegisterTranslatorMock(new Mock <ITranslator <OrganizationAddress, VmAddressSimple> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <OrganizationDescription, VmDescription> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <OrganizationEmail, VmEmailData> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <OrganizationName, VmName> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <Business, VmBusiness> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <OrganizationWebPage, VmWebPage> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <OrganizationPhone, VmPhone> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <OrganizationDisplayNameType, VmDispalyNameType> >(), unitOfWorkMock),
            };

            RegisterDbSet(CreateCodeData <PublishingStatusType>(typeof(PublishingStatus)), unitOfWorkMockSetup);
            RegisterDbSet(new List <OrganizationVersioned>(), unitOfWorkMockSetup);
            RegisterEntityForVersionManager <OrganizationVersioned>();

            itemListGenerator = new ItemListModelGenerator();
            conversion        = new TestConversion();
        }
예제 #2
0
        public ServiceTranslatorTest()
        {
            unitOfWorkMock = unitOfWorkMockSetup.Object;

            SetupTypesCacheMock <NameType>(typeof(NameTypeEnum));
            SetupTypesCacheMock <PublishingStatusType>(typeof(PublishingStatus));
            SetupTypesCacheMock <ProvisionType>(typeof(ProvisionTypeEnum));

            translators = new List <object>
            {
                new ServiceTranslator(ResolveManager, TranslationPrimitives, CacheManager.TypesCache),
                new PublishingStatusTypeTranslator(ResolveManager, TranslationPrimitives),
                new ServiceNameTranslator(ResolveManager, TranslationPrimitives),
                new ServiceDescriptionTranslator(ResolveManager, TranslationPrimitives),
                new ServiceRequirementTranslator(ResolveManager, TranslationPrimitives),
                new ServiceProducerTranslator(ResolveManager, TranslationPrimitives, CacheManager),
                new ServiceProducerOrganizationTranslator(ResolveManager, TranslationPrimitives),
                new ServiceProducerAdditionalInformationTranslator(ResolveManager, TranslationPrimitives, CacheManager),

                RegisterTranslatorMock(new Mock <ITranslator <Language, string> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <NameType, string> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <DescriptionType, string> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceTargetGroup, VmTargetGroupListItem> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceOntologyTerm, VmTreeItem> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceServiceClass, VmTreeItem> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceLifeEvent, VmTreeItem> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceKeyword, VmKeywordItem> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <OrganizationService, VmTreeItem> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <OrganizationService, VmServiceProducer> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceElectronicNotificationChannel, string> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceElectronicCommunicationChannel, string> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceServiceChannel, VmChannelListItem> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceChannelVersioned, VmElectronicChannelStep1> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceChannelVersioned, IVmChannelDescription> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceLanguage, VmListItem> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceKeyword, VmTreeItem> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceTargetGroup, VmListItem> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceOntologyTerm, VmListItem> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceServiceClass, VmListItem> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceLifeEvent, VmListItem> >(), unitOfWorkMock),
            };

            RegisterDbSet(CreateCodeData <PublishingStatusType>(typeof(PublishingStatus)), unitOfWorkMockSetup);
            RegisterDbSet(new List <ServiceVersioned>(), unitOfWorkMockSetup);

            treeGenerator     = new TreeModelGenerator();
            itemListGenerator = new ItemListModelGenerator();
            conversion        = new TestConversion();
        }
예제 #3
0
        public LocationChannelTranslatorTest()
        {
            translators = new List <object>()
            {
                new LocationChannelStep1Translator(ResolveManager, TranslationPrimitives),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceLocationChannelAddress, VmAddressSimple> >(), unitOfWorkMock),
            };

            RegisterDbSet(new List <ServiceLocationChannel>(), unitOfWorkMockSetup);
            RegisterDbSet(new List <ServiceChannelWebPage>(), unitOfWorkMockSetup);
            itemListGenerator = new ItemListModelGenerator();
            conversion        = new TestConversion();
            itemListGenerator = new ItemListModelGenerator();
            unitOfWorkMock    = unitOfWorkMockSetup.Object;
        }
        public LocationChannelWebPageTranslatorTest()
        {
            unitOfWorkMock = unitOfWorkMockSetup.Object;
            translators    = new List <object>()
            {
                new ServiceChannelWebPageTranslator(ResolveManager, TranslationPrimitives),
                new WebPageTypeCodeTranslator(ResolveManager, TranslationPrimitives),

                RegisterTranslatorMock(new Mock <ITranslator <WebPage, VmWebPage> >(), unitOfWorkMock),
            };
            RegisterDbSet(CreateCodeData <WebPageType>(typeof(WebPageTypeEnum)), unitOfWorkMockSetup);
            RegisterDbSet(new List <ServiceChannelWebPage>(), unitOfWorkMockSetup);

            itemListGenerator = new ItemListModelGenerator();
            conversion        = new TestConversion();
            itemListGenerator = new ItemListModelGenerator();
        }
        public PostOfficeBoxNamesTranslatorTest()
        {
            var unitOfWorkMockSetup = new Mock <IUnitOfWork>();

            unitOfWorkMock = unitOfWorkMockSetup.Object;
            translators    = new List <object>()
            {
                new PostOfficeBoxNameTranslator(ResolveManager, TranslationPrimitives),

                RegisterTranslatorMock(new Mock <ITranslator <Language, string> >(), unitOfWorkMock),
            };
            RegisterDbSet(new List <PostOfficeBoxName>(), unitOfWorkMockSetup);

            itemListGenerator = new ItemListModelGenerator();
            conversion        = new TestConversion();
            itemListGenerator = new ItemListModelGenerator();
        }
예제 #6
0
        public DailyOpeningHourTranslatorTest()
        {
            unitOfWorkMock = unitOfWorkMockSetup.Object;
            translators    = new List <object>
            {
                new DailyOpeningHourTranslator(ResolveManager, TranslationPrimitives),
                new DailyOpeningHourExtraTranslator(ResolveManager, TranslationPrimitives),
                new DailyHoursTranslator(ResolveManager, TranslationPrimitives)
//                RegisterTranslatorMock(new Mock<ITranslator<DailyOpeningTime, IDailyHours>>(), unitOfWorkMock),
            };

            RegisterDbSet(new List <DailyOpeningTime>(), unitOfWorkMockSetup);

            itemListGenerator = new ItemListModelGenerator();
            conversion        = new TestConversion();
            itemListGenerator = new ItemListModelGenerator();
        }
예제 #7
0
        public OrganizationAddressTranslatorTest()
        {
            unitOfWorkMock = unitOfWorkMockSetup.Object;
            translators    = new List <object>()
            {
                new OrganizationAddressTranslator(ResolveManager, TranslationPrimitives, CacheManager),
                new AddressTypeCodeTranslator(ResolveManager, TranslationPrimitives),

                RegisterTranslatorMock(new Mock <ITranslator <Address, VmAddressSimple> >(), unitOfWorkMock),
            };
            RegisterDbSet(CreateCodeData <AddressCharacter>(typeof(AddressCharacterEnum)), unitOfWorkMockSetup);
            RegisterDbSet(new List <OrganizationAddress>(), unitOfWorkMockSetup);

            itemListGenerator = new ItemListModelGenerator();
            conversion        = new TestConversion();
            itemListGenerator = new ItemListModelGenerator();
        }
        public SpecialOpeningHourTranslatorTest()
        {
            unitOfWorkMock = unitOfWorkMockSetup.Object;
            var typesCacheMock = SetupTypesCacheMock <ServiceHourType>();

            listModelGenerator = new ItemListModelGenerator();

            translators = new List <object>
            {
                new SpecialOpeningHourTranslator(ResolveManager, TranslationPrimitives, typesCacheMock.Object, new PTV.Database.DataAccess.Translators.Channels.EntityDefinitionHelper()),

                new ServiceHourTranslator(ResolveManager, TranslationPrimitives, typesCacheMock.Object),
                new DailyHoursTranslator(ResolveManager, TranslationPrimitives),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceHoursAdditionalInformation, VmStringText> >(), unitOfWorkMock)
            };
            RegisterDbSet(new List <ServiceHours>(), unitOfWorkMockSetup);
            RegisterDbSet(new List <DailyOpeningTime>(), unitOfWorkMockSetup);
        }
예제 #9
0
        public CountryTranslatorTest()
        {
            unitOfWorkMock = unitOfWorkMockSetup.Object;
            translators    = new List <object>()
            {
                new CountryCodeTranslator(ResolveManager, TranslationPrimitives),

                RegisterTranslatorMock(new Mock <ITranslator <Language, string> >(), unitOfWorkMock),
            };
//            RegisterDbSet(CreateTypeData<ServiceChannelType>(typeof(ServiceChannelTypeEnum)), unitOfWorkMock);
            RegisterDbSet(CreateCodeData <PublishingStatusType>(typeof(PublishingStatus)), unitOfWorkMockSetup);

            RegisterDbSet(CreateCodeData <Country>(typeof(CountryCode)), unitOfWorkMockSetup);
//            RegisterDbSet(new List<ServiceChannelServiceHours>(), unitOfWorkMock);

            itemListGenerator = new ItemListModelGenerator();
            conversion        = new TestConversion();
            itemListGenerator = new ItemListModelGenerator();
        }
예제 #10
0
        public NormalOpeningHourTranslatorTest()
        {
            unitOfWorkMock = unitOfWorkMockSetup.Object;
            var typesCacheMock = SetupTypesCacheMock<ServiceHourType>();
            listModelGenerator = new ItemListModelGenerator();

            translators = new List<object>
            {
                new NormalOpeningHourTranslator(ResolveManager, TranslationPrimitives, typesCacheMock.Object, new ServiceChannelTranslationDefinitionHelper(CacheManager)),
                new ServiceHourTranslator(ResolveManager, TranslationPrimitives, typesCacheMock.Object),
                RegisterTranslatorMock(new Mock<ITranslator<ServiceHoursAdditionalInformation, VmStringText>>(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock<ITranslator<DailyOpeningTime, VmDailyHours>>(), unitOfWorkMock,
                    d => new DailyOpeningTime { CreatedBy = "daily"},
                    dot => new VmDailyHours { DayFrom = (WeekDayEnum) Enum.ToObject(typeof(WeekDayEnum), dot.DayFrom), TimeFrom = dot.From.ToEpochTimeOfDay(), TimeTo = dot.To.ToEpochTimeOfDay() }
                ),
                RegisterTranslatorMock(new Mock<ITranslator<DailyOpeningTime, VmExtraHours>>(), unitOfWorkMock, d => new DailyOpeningTime { CreatedBy = "extra"}),
            };
            RegisterDbSet(new List<ServiceHours>(), unitOfWorkMockSetup);
        }
예제 #11
0
        public LocationChannelAddressTranslatorTest()
        {
            unitOfWorkMock = unitOfWorkMockSetup.Object;
            translators    = new List <object>()
            {
                new LocationChannelAddressTranslator(ResolveManager, TranslationPrimitives, CacheManager),
                new AddressTypeCodeTranslator(ResolveManager, TranslationPrimitives),

                RegisterTranslatorMock(new Mock <ITranslator <Address, VmAddressSimple> >(), unitOfWorkMock),
            };
            RegisterDbSet(CreateCodeData <AddressCharacter>(typeof(AddressCharacterEnum)), unitOfWorkMockSetup);
//            RegisterDbSet(CreateTypeData<PublishingStatusType>(typeof(PublishingStatus)), unitOfWorkMock);

//            RegisterDbSet(new List<Attachment>(), unitOfWorkMock);
            RegisterDbSet(new List <ServiceLocationChannelAddress>(), unitOfWorkMockSetup);

            itemListGenerator = new ItemListModelGenerator();
            conversion        = new TestConversion();
            itemListGenerator = new ItemListModelGenerator();
        }
예제 #12
0
        public StreetAddressTranslatorTest()
        {
            var unitOfWorkMockSetup = new Mock <IUnitOfWork>();

            unitOfWorkMock = unitOfWorkMockSetup.Object;
            translators    = new List <object>()
            {
                new StreetNamesTranslator(ResolveManager, TranslationPrimitives),

                RegisterTranslatorMock(new Mock <ITranslator <Language, string> >(), unitOfWorkMock),
            };
//            RegisterDbSet(CreateTypeData<ServiceChannelType>(typeof(ServiceChannelTypeEnum)), unitOfWorkMock);
//            RegisterDbSet(CreateTypeData<PublishingStatusType>(typeof(PublishingStatus)), unitOfWorkMock);

//            RegisterDbSet(new List<Address>(), unitOfWorkMock);
            RegisterDbSet(new List <StreetName>(), unitOfWorkMockSetup);

            itemListGenerator = new ItemListModelGenerator();
            conversion        = new TestConversion();
            itemListGenerator = new ItemListModelGenerator();
        }
예제 #13
0
        public ExceptionalOpeningHourTranslatorTest()
        {
            unitOfWorkMock = unitOfWorkMockSetup.Object;
            var typesCacheMock = SetupTypesCacheMock <ServiceHourType>();

            listModelGenerator = new ItemListModelGenerator();

            translators = new List <object>
            {
                new ExceptionalOpeningHourTranslator(ResolveManager, TranslationPrimitives, typesCacheMock.Object, new ServiceChannelTranslationDefinitionHelper(CacheManager)),

                new ServiceHourTranslator(ResolveManager, TranslationPrimitives, typesCacheMock.Object),
                new DailyHoursTranslator(ResolveManager, TranslationPrimitives),
//                RegisterTranslatorMock(new Mock<ITranslator<DailyOpeningTime, IDailyHours>>(), unitOfWorkMock,
//                    d => new DailyOpeningTime { IsExtra = false, CreatedBy = "daily", From = new TimeSpan(1,0,0), To = new TimeSpan(2,0,0)}
//                    ),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceHoursAdditionalInformation, VmStringText> >(), unitOfWorkMock),
            };
            RegisterDbSet(new List <ServiceHours>(), unitOfWorkMockSetup);
            RegisterDbSet(new List <DailyOpeningTime>(), unitOfWorkMockSetup);
        }
예제 #14
0
        public ServiceChannelServiceHourTranslatorTest()
        {
            var unitOfWorkMockSetup = new Mock <IUnitOfWork>();

            unitOfWorkMock = unitOfWorkMockSetup.Object;
            var typesCacheMock = SetupTypesCacheMock <ServiceHourType>();

            listModelGenerator = new ItemListModelGenerator();

            translators = new List <object>
            {
                new ServiceHourTranslator(ResolveManager, TranslationPrimitives, typesCacheMock.Object),
                new TextTranslator(ResolveManager, TranslationPrimitives),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceHoursAdditionalInformation, VmStringText> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <DailyOpeningTime, VmDailyHours> >(), unitOfWorkMock, d => new DailyOpeningTime {
                    CreatedBy = "daily"
                }),
                RegisterTranslatorMock(new Mock <ITranslator <DailyOpeningTime, VmExtraHours> >(), unitOfWorkMock, d => new DailyOpeningTime {
                    CreatedBy = "extra"
                }),
            };
            RegisterDbSet(new List <ServiceHours>(), unitOfWorkMockSetup);
        }
        public OpeningHoursTranslatorTest()
        {
            unitOfWorkMock = unitOfWorkMockSetup.Object;
            var typesCacheMock = SetupTypesCacheMock <ServiceHourType>();

            translators = new List <object>
            {
                new ServiceChannelOpeningHoursTranslator(ResolveManager, TranslationPrimitives, typesCacheMock.Object),
//                new PublishingStatusTypeTranslator(ResolveManager, TranslationPrimitives),

                RegisterTranslatorMock(new Mock <ITranslator <ServiceChannelServiceHours, VmNormalHours> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceChannelServiceHours, VmSpecialHours> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceChannelServiceHours, VmExceptionalHours> >(), unitOfWorkMock),
            };
//            RegisterDbSet(CreateCodeData<ServiceChannelType>(typeof(ServiceChannelTypeEnum)), unitOfWorkMockSetup);
//            RegisterDbSet(CreateCodeData<PublishingStatusType>(typeof(PublishingStatus)), unitOfWorkMockSetup);

            RegisterDbSet(new List <ServiceChannelVersioned>(), unitOfWorkMockSetup);
//            RegisterDbSet(new List<ServiceChannelServiceHours>(), unitOfWorkMock);

            itemListGenerator = new ItemListModelGenerator();
            conversion        = new TestConversion();
            itemListGenerator = new ItemListModelGenerator();
        }
        public LocationChannelMainTranslatorTest()
        {
            unitOfWorkMock = unitOfWorkMockSetup.Object;
            var duplicatedEntity = new ServiceChannelVersioned()
            {
                CreatedBy = "ITranslator<ServiceChannel, IVmChannelDescription>>"
            };

            translators = new List <object>()
            {
                new LocationChannelMainStep1Translator(ResolveManager, TranslationPrimitives, new ServiceChannelTranslationDefinitionHelper(CacheManager), CacheManager),

                RegisterTranslatorMock(new Mock <ITranslator <ServiceChannelVersioned, IVmChannelDescription> >(), unitOfWorkMock,
                                       desc =>
                {
//                        var x = TranslatedInstanceStorage.ProcessInstance(desc, duplicatedEntity);
                    duplicatedEntity.OrganizationId = desc.OrganizationId ?? Guid.Empty;
                    duplicatedEntity.ServiceChannelNames.Add(new ServiceChannelName {
                        Name = desc.Name
                    });
                    return(duplicatedEntity);
                },
                                       setTargetAction: sc => duplicatedEntity = sc
                                       ),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceLocationChannel, VmLocationChannelStep1> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceChannelVersioned, VmOpeningHoursStep> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceChannelVersioned, IPhoneNumberAndFax> >(), unitOfWorkMock,
                                       phones =>
                {
//                        var x = TranslatedInstanceStorage.ProcessInstance(phones, duplicatedEntity);
                    duplicatedEntity.Phones.Add(new ServiceChannelPhone {
                        CreatedBy = phones.PhoneNumber.Number
                    });
                    return(duplicatedEntity);
                },
                                       setTargetAction: sc => duplicatedEntity = sc
                                       ),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceChannelVersioned, IEmail> >(), unitOfWorkMock,
                                       email =>
                {
//                        var x = TranslatedInstanceStorage.ProcessInstance(email, duplicatedEntity);
                    duplicatedEntity.Emails.Add(new ServiceChannelEmail {
                        Email = new Email {
                            Value = email.Email.Email
                        }
                    });
                    return(duplicatedEntity);
                },
                                       setTargetAction: sc => duplicatedEntity = sc
                                       ),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceChannelLanguage, VmListItem> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceChannelWebPage, VmWebPage> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceChannelEmail, VmEmailData> >(), unitOfWorkMock),
                RegisterTranslatorMock(new Mock <ITranslator <ServiceChannelPhone, VmPhone> >(), unitOfWorkMock)
            };
            RegisterDbSet(CreateCodeData <ServiceChannelType>(typeof(ServiceChannelTypeEnum)), unitOfWorkMockSetup);
            RegisterDbSet(CreateCodeData <PublishingStatusType>(typeof(PublishingStatus)), unitOfWorkMockSetup);

            RegisterDbSet(new List <ServiceChannel>(), unitOfWorkMockSetup);
            RegisterDbSet(new List <ServiceChannelVersioned>(), unitOfWorkMockSetup);
            RegisterDbSet(new List <Versioning>(), unitOfWorkMockSetup);

            itemListGenerator = new ItemListModelGenerator();
            conversion        = new TestConversion();
            itemListGenerator = new ItemListModelGenerator();
        }