protected EventWebServicesTests(string baseUri)
        {
            if (string.IsNullOrWhiteSpace(baseUri)) throw new ArgumentNullException(nameof(baseUri));
            if (!Uri.IsWellFormedUriString(baseUri, UriKind.RelativeOrAbsolute)) throw new FormatException("baseUri");

            var rndGenerator = new RandomGenerator();
            GuidKeyGenerator = new SequentialGuidKeyGenerator();
            var fpiKeyGenerator = new FpiKeyGenerator(
                new ContentGenerator<ApprovalStatus>(() => Pick<ApprovalStatus>.RandomItemFrom(new[]
                {
                    ApprovalStatus.Informal, 
                    ApprovalStatus.None
                })),
                new ContentGenerator<string>(() => Pick<string>.RandomItemFrom(new[]
                {
                    "RXJG",
                    "GOGL",
                    "MSFT",
                    "YHOO"
                })),

                new ContentGenerator<string>(() => Pick<string>.RandomItemFrom(new[]
                {
                    "DTD",
                    "XSL",
                    "XML",
                    "JSON"
                })), 
                
                new ContentGenerator<string>(() => rndGenerator.Phrase(10)),
                new ContentGenerator<string>(() => Pick<string>.RandomItemFrom(new[]
                {
                    "EN",
                    "FR",
                    "DE",
                    "ES",
                    "IT",
                    "PL",
                    "RO"
                })));

            var valuesFactory = new ValuesFactory(GuidKeyGenerator);
            var parametersFactory = new ParametersFactory(valuesFactory);
            PropertiesFactory = new PropertiesFactory(GuidKeyGenerator, valuesFactory, parametersFactory);
            AlarmFactory = new AlarmFactory(GuidKeyGenerator, PropertiesFactory, valuesFactory);

            EventFactory = new EventFactory(GuidKeyGenerator, AlarmFactory, PropertiesFactory, valuesFactory);
            CalendarFactory = new CalendarFactory(GuidKeyGenerator, fpiKeyGenerator);

            ServiceClientFactory = new ServiceClientFactory();
            ServiceClientFactory.Register(() => new JsonServiceClient(baseUri));
            ServiceClientFactory.Register(() => new JsvServiceClient(baseUri));
            ServiceClientFactory.Register(() => new XmlServiceClient(baseUri));

            TestService = new EventTestService();
        }
示例#2
0
        public EventUnitTests()
        {
            keyGenerator = new SequentialGuidKeyGenerator();
            var valuesFactory = new ValuesFactory(keyGenerator);
            var parametersFactory = new ParametersFactory(valuesFactory);
            var propertiesFactory = new PropertiesFactory(keyGenerator, valuesFactory, parametersFactory);
            var alarmFactory = new AlarmFactory(keyGenerator, propertiesFactory, valuesFactory);

            factory = new EventFactory(keyGenerator, alarmFactory, propertiesFactory, valuesFactory);

            tzid = new TZID("America", "New_York");
        }