protected CalendarWebServicesTests(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();
            var 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(20)),
                new ContentGenerator<string>(() => Pick<string>.RandomItemFrom(new[]
                {
                    "EN",
                    "FR",
                    "DE",
                    "ES",
                    "IT",
                    "PL",
                    "RO"
                })));

            var valuesFactory = new ValuesFactory(guidKeyGenerator);
            var parametersFactory = new ParametersFactory(valuesFactory);
            var propertiesFactory = new PropertiesFactory(guidKeyGenerator, valuesFactory, parametersFactory);
            var 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 CalendarTestService();

        }
Example #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");
        }