public static TExtended Wrap <TOriginal, TExtended>(this TOriginal resource) where TOriginal : IClientResource where TExtended : TOriginal, IClientResource { var typeMapper = ClientTypeMapper.GetTypeMapper(typeof(TOriginal)); return((TExtended)typeMapper.WrapResource(resource, typeof(TOriginal), typeof(TExtended))); }
internal ClientSerializationContextProvider(ClientTypeMapper clientTypeMapper, IPomonaClient client) { if (clientTypeMapper == null) throw new ArgumentNullException("clientTypeMapper"); if (client == null) throw new ArgumentNullException("client"); this.clientTypeMapper = clientTypeMapper; this.client = client; }
public TestableClientProxyBase() { Settings = new ClientSettings(); this.postHandlers = new Dictionary <Type, Delegate>(); this.repositoryCache = new Dictionary <string, object>(); this.resourceCollections = new Dictionary <Type, object>(); this.idCounter = 1; var proxiedClientInterface = GetType().GetInterfaces().Except((typeof(TestableClientProxyBase).GetInterfaces())).Single(); TypeMapper = new ClientTypeMapper(proxiedClientInterface.Assembly); }
public RequestDispatcher(ClientTypeMapper typeMapper, IWebClient webClient, ITextSerializerFactory serializerFactory, IEnumerable<KeyValuePair<string, IEnumerable<string>>> defaultHeaders = null) { this.defaultHeaders = defaultHeaders; if (typeMapper != null) this.typeMapper = typeMapper; if (webClient != null) WebClient = webClient; if (serializerFactory != null) this.serializerFactory = serializerFactory; }
internal ClientSerializationContextProvider(ClientTypeMapper clientTypeMapper, IPomonaClient client, IResourceLoader resourceLoader) { if (clientTypeMapper == null) throw new ArgumentNullException(nameof(clientTypeMapper)); if (client == null) throw new ArgumentNullException(nameof(client)); if (resourceLoader == null) throw new ArgumentNullException(nameof(resourceLoader)); this.clientTypeMapper = clientTypeMapper; this.client = client; this.resourceLoader = resourceLoader; }
internal ClientSerializationContextProvider(ClientTypeMapper clientTypeMapper, IPomonaClient client, IResourceLoader resourceLoader) { if (clientTypeMapper == null) { throw new ArgumentNullException(nameof(clientTypeMapper)); } if (client == null) { throw new ArgumentNullException(nameof(client)); } if (resourceLoader == null) { throw new ArgumentNullException(nameof(resourceLoader)); } this.clientTypeMapper = clientTypeMapper; this.client = client; this.resourceLoader = resourceLoader; }
public void SetUp() { this.typeMapper = new ClientTypeMapper(typeof(CritterClient).Assembly); }
public void SetUp() { this.typeMapper = new ClientTypeMapper(new[] { typeof(ITestResource) }); this.extendedMapper = new ExtendedResourceMapper(this.typeMapper); }
public void SetUp() { this.clientTypeMapper = new ClientTypeMapper(typeof(ICritter).WrapAsEnumerable()); }
public void CritterType_ReturnsCorrectPluralName() { var clientTypeMapper = new ClientTypeMapper(typeof(ICritter).WrapAsEnumerable()); var critterType = (ResourceType)clientTypeMapper.FromType(typeof(ICritter)); Assert.That(critterType.PluralName, Is.EqualTo("Critters")); }
public void SetUp() { this.clientTypeMapper = new ClientTypeMapper(typeof(ICritter).WrapAsEnumerable()); }
public void SetUp() { this.typeMapper = new ClientTypeMapper(new[] { typeof(ITestResource) }); this.extendedMapper = new ExtendedResourceMapper(this.typeMapper); }