示例#1
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();
            }
        }
        public void ServiceFactoryDiscovery_ConstructorSuccessTest()
        {
            var param = new FactoryParameterV0_3("server", "http://base");
            var json = (JsonDictionary) JsonReader.Parse(BuzzV0_3_Json);
            var fact = new ServiceFactoryDiscoveryV0_3(json, param);

            Assert.AreEqual("buzz", fact.Name);
            Assert.AreEqual(param, fact.Param);
            Assert.AreEqual(json, fact.Information);
            Assert.IsInstanceOf(typeof(ServiceV0_3), fact.GetService());
        }