public void ConstuctorArgumentValidationTest() { var param = new FactoryParameterV0_3("http://server/"); var js = new JsonDictionary(); js["name"] = "TestName"; js["version"] = "v1"; js["restBasePath"] = "test/path"; Assert.Throws(typeof(ArgumentNullException), () => new ServiceV0_3(null, js)); Assert.Throws(typeof(ArgumentNullException), () => new ServiceV0_3(param, null)); new ServiceV0_3(param, js); }
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()); }
private ServiceV0_3 CreateService() { var param = new FactoryParameterV0_3("http://server/"); var json = (JsonDictionary) JsonReader.Parse(ServiceFactoryImplTest.BuzzV0_3_Json); return new ServiceV0_3(param, json); }
public void ServiceFactoryDiscovery_ConstructorFailTest() { var param = new FactoryParameterV0_3("server", "base"); var json = (JsonDictionary) JsonReader.Parse(BuzzV0_3_Json); Assert.Throws(typeof(ArgumentNullException), () => new ServiceFactoryDiscoveryV0_3(null, param)); Assert.Throws(typeof(ArgumentNullException), () => new ServiceFactoryDiscoveryV0_3(json, null)); json = (JsonDictionary) JsonReader.Parse(Discovery.ServiceFactoryImplTest.BadDiscoveryv1_0_No_Name); Assert.Throws(typeof(ArgumentException), () => new ServiceFactoryDiscoveryV0_3(json, param)); }