public void SerializerConfigBasicSetup() { var model = new MyModel(); Assert.True(model.IsDefined(typeof(A))); Assert.False(model.IsDefined(typeof(B))); Assert.True(model.IsDefined(typeof(Haz))); Assert.False(model.IsDefined(typeof(HazNot))); Assert.True(model.IsDefined(typeof(Proxied))); var serType = TypeModel.TryGetSerializer <A>(model)?.GetType(); Assert.Equal(typeof(EnumSerializerInt32 <A>), serType); Assert.Equal(typeof(A), serType.GetGenericArguments().Single()); serType = TypeModel.TryGetSerializer <B>(model)?.GetType(); Assert.Null(serType); Assert.IsType <MyProvider>(TypeModel.TryGetSerializer <Haz>(model)); Assert.Null(TypeModel.TryGetSerializer <HazNot>(model)); Assert.IsType <ProxySerializer>(TypeModel.TryGetSerializer <Proxied>(model)); // now let's look just via the model serType = model.GetSerializer <A>()?.GetType(); Assert.Equal(typeof(EnumSerializerInt32 <A>), serType); Assert.Equal(typeof(A), serType.GetGenericArguments().Single()); // B *should not* work when accessed directly Assert.Null(model.GetSerializer <B>()); Assert.IsType <MyProvider>(model.GetSerializer <Haz>()); Assert.Null(model.GetSerializer <HazNot>()); Assert.IsType <ProxySerializer>(model.GetSerializer <Proxied>()); }