Example #1
0
 public void DefaultSerializer()
 {
     const String contentType = "application/json";
     var factory = new SerializerFactory();
     var serializer = factory.Create(contentType);
     Assert.IsType<JsonSerializer>(serializer);
 }
Example #2
0
 public void NotFound()
 {
     const String contentType = "application/unknow";
     var factory = new SerializerFactory();
     var serializer = factory.Create(contentType);
     Assert.IsType<NullSerializer>(serializer);
 }
Example #3
0
 public void CustomMap()
 {
     const String contentType = "application/dummy";
     var map = new Dictionary<String, ISerializer>
                   {
                       { contentType, new FakeSerializer() }
                   };
     var factory = new SerializerFactory(map);
     var serializer = factory.Create(contentType);
     Assert.IsType<FakeSerializer>(serializer);
 }