public void Init() { this.nancyContext = new NancyContext(); this.nancyContext.Request = new Request("Get", "http://test"); this.serializationContextProvider = new ClientSerializationContextProvider(new ClientTypeMapper(Assembly.GetExecutingAssembly()), Client, Client); this.serializerFactory = new PomonaJsonSerializerFactory(); }
public ServersStorage(ILogger logger, ITextSerializerFactory serializerFactory, string filePath) { _origin = new CollectionStorage <T>( new SafeStorage <IEnumerable <T> >( new LoggingStorage <IEnumerable <T> >( logger, new FileStorage <IEnumerable <T> >(serializerFactory, filePath)))); }
public StreamingServicesStorage(ILogger logger, ITextSerializerFactory serializers, Common.Configuration.Config config) { _storage = new SafeStorage <StreamingServicesResponse>( new LoggingStorage <StreamingServicesResponse>( logger, new FileStorage <StreamingServicesResponse>( serializers, config.StreamingServicesFilePath))); }
public SettingsStorage(ILogger logger, ITextSerializerFactory serializers, Common.Configuration.Config config) { _origin = new SafeStorage <SettingsContract>( new LoggingStorage <SettingsContract>( logger, new FileStorage <SettingsContract>( serializers, config.ServiceSettingsFilePath))); }
public ServerCache(ILogger logger, ITextSerializerFactory serializerFactory, Config config) { _origin = new CollectionStorage <LogicalServerContract>( new SafeStorage <IEnumerable <LogicalServerContract> >( new LoggingStorage <IEnumerable <LogicalServerContract> >( logger, new FileStorage <IEnumerable <LogicalServerContract> >( serializerFactory, config.ServersJsonCacheFilePath)))); }
public FileStorage(ITextSerializerFactory serializerFactory, string fileName) { Ensure.NotNull(serializerFactory, nameof(serializerFactory)); Ensure.NotEmpty(fileName, nameof(fileName)); _serializer = serializerFactory.Serializer <T>(); Ensure.IsTrue(_serializer is IThrowsExpectedExceptions, $"{nameof(serializerFactory)}.{nameof(ITextSerializerFactory.Serializer)} must implement {nameof(IThrowsExpectedExceptions)} interface"); _fileName = fileName; }
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; }
public void TestInitialize() { _serializer = Substitute.For <ITextSerializer <int>, IThrowsExpectedExceptions>(); _serializer .Deserialize(Arg.Any <TextReader>()) .Returns(args => int.Parse(args.Arg <TextReader>().ReadToEnd())); _serializer .When(x => x.Serialize(Arg.Any <int>(), Arg.Any <TextWriter>())) .Do(args => args.Arg <TextWriter>().Write(args.Arg <int>().ToString())); _serializerFactory = Substitute.For <ITextSerializerFactory>(); _serializerFactory.Serializer <int>().Returns(_serializer); }
public PomonaRequest(PathNode node, NancyContext context, ITextSerializerFactory serializerFactory) { if (node == null) throw new ArgumentNullException("node"); if (context == null) throw new ArgumentNullException("context"); if (serializerFactory == null) throw new ArgumentNullException("serializerFactory"); this.node = node; this.context = context; this.serializerFactory = serializerFactory; this.method = (HttpMethod)Enum.Parse(typeof(HttpMethod), context.Request.Method, true); }
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; } }