public void ServiceFactoryDiscoveryV1_0ConstructorSuccessTest()
        {
            var param = new FactoryParameterV1_0("http://server/");
            var json = (JsonDictionary) JsonReader.Parse(ServiceFactoryTest.DiscoveryV1_0Example);
            var fact = new ServiceFactoryDiscoveryV1_0(json, param);

            Assert.AreEqual("adsense", fact.Name);
            Assert.AreEqual(param, fact.Param);
            Assert.AreEqual(json, fact.Information);
            Assert.IsInstanceOf(typeof(ServiceV1_0), fact.GetService());
        }
示例#2
0
        /// <summary>
        /// Get an IServiceFactory instance for a specific version of the discovery service.
        /// </summary>
        /// <remarks>
        /// Currently supports discovery versions 0.3 and 1.0
        /// </remarks>
        public static IServiceFactory Get(DiscoveryVersion version)
        {
            switch (version)
            {
            case DiscoveryVersion.Version_0_3:
                return(ServiceFactoryDiscoveryV0_3.GetInstance());

            case DiscoveryVersion.Version_1_0:
                return(ServiceFactoryDiscoveryV1_0.GetInstance());

            default:
                throw new NotSupportedException();
            }
        }