private void InitializeEndpointCollectionWithGlobalDefaultsOnly() { var jsonEndpoint1 = new JSONEndpoint { name = "foobar", pathregex = "foobar", responses = new[] { new JSONResponse { match = new JSONRequestMatcher(), file = "myfile.xml" } } }; var jsonEndpoint2 = new JSONEndpoint { name = "baz", pathregex = "baz", responses = new[] { new JSONResponse { match = new JSONRequestMatcher(), file = "myfile.xml", contenttype = "text/xml", charset = "utf-8" } } }; var jsonEndpoint3 = new JSONEndpoint { name = "lorem", pathregex = "ipsum", responses = new[] { new JSONResponse { match = new JSONRequestMatcher(), file = "myfile.xml", contenttype = "text/xml", statuscode = "200" } } }; directoryCreator.AddFile("defaults.json", JsonConvert.SerializeObject(new JSONDefaults { charset = "ascii", contenttype = "application/xml" })); directoryCreator.AddFile("endpoint1/endpoint.json", JsonConvert.SerializeObject(jsonEndpoint1)); directoryCreator.AddFile("endpoint2/endpoint.json", JsonConvert.SerializeObject(jsonEndpoint2)); directoryCreator.AddFile("endpoint3/endpoint.json", JsonConvert.SerializeObject(jsonEndpoint3)); endpointCollection = EndpointCollectionReader.ReadFromDirectory(directoryCreator.DirectoryName); }
private void InitializeEndpointCollectionWithoutDefaults() { var jsonEndpoint1 = new JSONEndpoint { name = "foobar", pathregex = "foobar", responses = new[] { new JSONResponse { match = new JSONRequestMatcher(), file = "myfile.xml" } } }; directoryCreator.AddFile("endpoint1/endpoint.json", JsonConvert.SerializeObject(jsonEndpoint1)); endpointCollection = EndpointCollectionReader.ReadFromDirectory(directoryCreator.DirectoryName); }
private void InitializeEndpointCollectionWithGlobalAndEndpointDefaults() { var jsonEndpoint1 = new JSONEndpoint { name = "noendpointdefaults", pathregex = "noendpointdefaults", responses = new[] { new JSONResponse { match = new JSONRequestMatcher(), file = "myfile.xml" } } }; var jsonEndpoint2 = new JSONEndpoint { name = "endpointdefaults", pathregex = "endpointdefaults", responses = new[] { new JSONResponse { match = new JSONRequestMatcher(), file = "myfile.xml", } } }; var globalDefaults = new JSONDefaults { charset = "ascii", contenttype = "application/xml" }; var endpointDefaults = new JSONDefaults { charset = "UTF-7", contenttype = "text/plain" }; directoryCreator.AddFile("defaults.json", JsonConvert.SerializeObject(globalDefaults)); directoryCreator.AddFile("endpoint1/endpoint.json", JsonConvert.SerializeObject(jsonEndpoint1)); directoryCreator.AddFile("endpoint2/endpoint.json", JsonConvert.SerializeObject(jsonEndpoint2)); directoryCreator.AddFile("endpoint2/defaults.json", JsonConvert.SerializeObject(endpointDefaults)); endpointCollection = EndpointCollectionReader.ReadFromDirectory(directoryCreator.DirectoryName); }