public MetadataProviderTest()
        {
            _serviceProvider = new ServiceCollection().AddLogging(builder => builder.AddConsole())
                               .BuildServiceProvider();
            var loggerFactory = _serviceProvider.GetService <ILoggerFactory>();
            var logger        = loggerFactory.CreateLogger("test");

            var httpClient     = new MockHttpClient();
            var jsonSerializer = new MockJsonSerializer();

            _doubanProvider = new MetadataProvider(httpClient, jsonSerializer, logger);
        }
Beispiel #2
0
        protected void SetupJsonSerializerDeserialize <T>(string response = null, T result = null)
            where T : class, new()
        {
            if (response == null)
            {
                response = It.IsAny <string>();
            }

            if (result == null)
            {
                result = new T();
            }

            MockJsonSerializer
            .Setup(x => x.Deserialize <T>(response))
            .Returns(result);
        }
Beispiel #3
0
 protected void SetupJsonSerializerSerialize(string result = RequestJson)
 {
     MockJsonSerializer
     .Setup(x => x.Serialize(It.IsAny <object>()))
     .Returns(result);
 }